apparmor.d/.gitlab-ci.yml

204 lines
4.5 KiB
YAML
Raw Normal View History

2021-04-04 00:30:06 +02:00
---
2021-11-09 23:41:12 +01:00
include:
- template: Security/SAST.gitlab-ci.yml
2021-04-04 00:30:06 +02:00
variables:
PKGDEST: $CI_PROJECT_DIR/.pkg
2021-04-04 00:30:06 +02:00
PACKAGER: 'Alexandre Pujol <alexandre@pujol.io>'
stages:
- lint
2021-12-05 01:21:16 +01:00
- test
2021-09-27 20:20:27 +02:00
- build
2021-04-04 00:30:06 +02:00
- preprocess
2023-01-29 22:18:22 +01:00
- deploy
2021-04-04 00:30:06 +02:00
# Code Linter
# -----------
bash:
stage: lint
image: koalaman/shellcheck-alpine
script:
- shellcheck --shell=bash
PKGBUILD dists/build.sh dists/docker.sh tests/check.sh
2023-04-24 16:28:33 +02:00
tests/packer/init/init.sh tests/packer/src/aa-update tests/packer/init/clean.sh
2021-04-04 00:30:06 +02:00
2021-11-09 23:41:12 +01:00
golangci-lint:
stage: lint
image: golangci/golangci-lint
script:
2024-10-19 23:57:08 +02:00
- golangci-lint run --exclude-dirs pkg/paths
2021-11-09 23:41:12 +01:00
2023-09-19 19:35:24 +02:00
packer:
stage: lint
image:
name: hashicorp/packer:latest
entrypoint: [""]
script:
- cd tests &&
packer fmt --check packer/ &&
packer validate --syntax-only packer/
2021-11-09 23:41:12 +01:00
sast:
stage: lint
2021-04-04 00:30:06 +02:00
2021-12-05 01:21:16 +01:00
# Code test
# ---------
tests:
stage: test
image: golang
2023-01-28 20:44:21 +01:00
coverage: '/Coverage: \d+.\d+/'
2021-12-05 01:21:16 +01:00
script:
2023-04-19 20:37:20 +02:00
- apt update && apt install -y rsync
- cp tests/journalctl /usr/bin/journalctl
- chmod 755 /usr/bin/journalctl
2023-03-12 18:03:07 +01:00
- mkdir -p /var/log/audit/
- touch /var/log/audit/audit.log /var/log/audit/audit.log.1
- go test ./cmd/... -v -cover -coverprofile=coverage.out
2024-04-28 13:23:47 +02:00
- go test $(go list ./pkg/... | grep -v /pkg/paths) -v -cover -coverprofile=coverage.out
2023-01-28 20:44:21 +01:00
- go tool cover -func=coverage.out
2021-12-05 01:21:16 +01:00
check:
2024-10-06 18:51:30 +02:00
stage: test
image: registry.gitlab.com/roddhjav/builders/archlinux
script:
- make check
2021-12-05 01:21:16 +01:00
2021-04-04 00:30:06 +02:00
# Package Build
# -------------
2023-03-28 00:18:33 +02:00
archlinux:
2021-09-27 20:20:27 +02:00
stage: build
2023-03-29 01:05:59 +02:00
image: registry.gitlab.com/roddhjav/builders/archlinux
2021-04-04 00:30:06 +02:00
script:
2023-04-19 19:57:31 +02:00
- sudo pacman -Syu --noconfirm --noprogressbar
2021-04-04 00:30:06 +02:00
- makepkg -s --noconfirm --noprogressbar
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*
2023-03-28 00:18:33 +02:00
debian:
2021-09-27 20:20:27 +02:00
stage: build
2023-03-29 01:05:59 +02:00
image: registry.gitlab.com/roddhjav/builders/debian
2021-04-04 00:30:06 +02:00
script:
2023-04-24 00:51:59 +02:00
- sudo chown -R build:build /builds/
2023-02-05 01:17:15 +01:00
- git config --global --add safe.directory $CI_PROJECT_DIR
2021-04-04 00:30:06 +02:00
- mkdir -p "$PKGDEST"
2023-04-19 19:57:31 +02:00
- sudo apt-get update -q && sudo apt-get install -y config-package-dev rsync
2023-09-21 00:08:17 +02:00
- sudo apt-get install -y -t bookworm-backports golang-go
- bash dists/build.sh dpkg
2021-04-04 00:30:06 +02:00
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.deb
2024-05-08 21:47:45 +02:00
ubuntu:
stage: build
image: registry.gitlab.com/roddhjav/builders/ubuntu
script:
2024-05-08 21:47:45 +02:00
- sudo chown -R ubuntu:ubuntu /builds/
- git config --global --add safe.directory $CI_PROJECT_DIR
- mkdir -p "$PKGDEST"
- sudo apt-get update -q && sudo apt-get install -y config-package-dev rsync golang-go
- bash dists/build.sh dpkg
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.deb
2022-10-16 00:37:10 +02:00
2023-11-14 00:41:41 +01:00
whonix:
extends: debian
variables:
DISTRIBUTION: whonix
2023-11-22 19:16:03 +01:00
before_script:
- echo "\noverride_dh_auto_build:\n\tmake full" >> debian/rules
2023-11-14 00:41:41 +01:00
2023-09-19 21:16:55 +02:00
opensuse:
stage: build
image: registry.gitlab.com/roddhjav/builders/opensuse
script:
- mkdir -p "$PKGDEST"
- sudo zypper install -y distribution-release golang-packaging rsync apparmor-profiles
2023-09-19 21:16:55 +02:00
- bash dists/build.sh rpm
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.rpm
2021-04-04 00:30:06 +02:00
# Profile Preprocessing
# ---------------------
2021-09-27 20:20:27 +02:00
preprocess-archlinux:
2021-04-04 00:30:06 +02:00
stage: preprocess
image: archlinux
dependencies:
- archlinux
script:
- pacman -Syu --noconfirm --noprogressbar apparmor
- pacman -U --noconfirm --noprogressbar $PKGDEST/*
2021-04-04 00:30:06 +02:00
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
2021-09-27 20:20:27 +02:00
preprocess-debian:
stage: preprocess
image: debian
dependencies:
- debian
script:
- apt-get update -q
2021-09-27 21:24:22 +02:00
- apt-get install -y apparmor apparmor-profiles
2021-09-27 20:20:27 +02:00
- dpkg --install $PKGDEST/*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
2022-10-16 00:37:10 +02:00
preprocess-ubuntu:
stage: preprocess
2022-10-16 00:37:10 +02:00
image: ubuntu
dependencies:
- ubuntu
script:
- apt-get update -q
- apt-get install -y apparmor apparmor-profiles
- dpkg --install $PKGDEST/*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
2023-11-14 00:41:41 +01:00
preprocess-whonix:
extends: preprocess-debian
dependencies:
- whonix
2023-01-29 22:18:22 +01:00
preprocess-opensuse:
stage: preprocess
2023-03-25 16:10:55 +01:00
image: opensuse/tumbleweed
2023-09-19 21:16:55 +02:00
dependencies:
- opensuse
script:
2023-09-19 21:16:55 +02:00
- zypper install -y apparmor-profiles
- rpm -i $PKGDEST/*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
2023-01-29 22:18:22 +01:00
# Deploy the documentation
# ------------------------
pages:
stage: deploy
image: python
variables:
2024-01-30 16:26:07 +01:00
MKDOCS_OFFLINE: "false"
GIT_STRATEGY: clone
GIT_DEPTH: 0
2023-01-29 22:18:22 +01:00
script:
- pip install -r requirements.txt
2024-09-26 21:20:20 +02:00
- mkdocs build --site-dir public
2023-01-29 22:18:22 +01:00
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH