2021-04-03 23:30:06 +01:00
|
|
|
---
|
|
|
|
|
2021-11-09 22:41:12 +00:00
|
|
|
include:
|
|
|
|
- template: Security/SAST.gitlab-ci.yml
|
|
|
|
|
2021-04-03 23:30:06 +01:00
|
|
|
variables:
|
|
|
|
PKGDEST: $CI_PROJECT_DIR/packages
|
|
|
|
PACKAGER: 'Alexandre Pujol <alexandre@pujol.io>'
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- lint
|
2021-12-05 00:21:16 +00:00
|
|
|
- test
|
2021-09-27 19:20:27 +01:00
|
|
|
- build
|
2021-04-03 23:30:06 +01:00
|
|
|
- preprocess
|
2023-01-29 21:18:22 +00:00
|
|
|
- deploy
|
2021-04-03 23:30:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Code Linter
|
|
|
|
# -----------
|
|
|
|
|
|
|
|
bash:
|
|
|
|
stage: lint
|
|
|
|
image: koalaman/shellcheck-alpine
|
|
|
|
script:
|
|
|
|
- shellcheck --shell=bash
|
2023-04-19 18:53:54 +01:00
|
|
|
PKGBUILD dists/build.sh
|
2023-04-24 15:28:33 +01:00
|
|
|
tests/packer/init/init.sh tests/packer/src/aa-update tests/packer/init/clean.sh
|
2021-04-03 23:30:06 +01:00
|
|
|
debian/apparmor.d.postinst debian/apparmor.d.postrm
|
|
|
|
|
2021-11-09 22:41:12 +00:00
|
|
|
golangci-lint:
|
|
|
|
stage: lint
|
|
|
|
image: golangci/golangci-lint
|
|
|
|
script:
|
2021-11-23 20:20:06 +00:00
|
|
|
- golangci-lint run
|
2021-11-09 22:41:12 +00:00
|
|
|
|
|
|
|
sast:
|
|
|
|
stage: lint
|
|
|
|
|
2021-04-03 23:30:06 +01:00
|
|
|
|
2021-12-05 00:21:16 +00:00
|
|
|
# Code test
|
|
|
|
# ---------
|
|
|
|
|
|
|
|
tests:
|
|
|
|
stage: test
|
|
|
|
image: golang
|
2023-01-28 19:44:21 +00:00
|
|
|
coverage: '/Coverage: \d+.\d+/'
|
2021-12-05 00:21:16 +00:00
|
|
|
script:
|
2023-04-19 19:37:20 +01:00
|
|
|
- apt update && apt install -y rsync
|
2022-10-15 22:05:52 +01:00
|
|
|
- cp tests/journalctl /usr/bin/journalctl
|
|
|
|
- chmod 755 /usr/bin/journalctl
|
2023-03-12 17:03:07 +00:00
|
|
|
- mkdir -p /var/log/audit/
|
|
|
|
- touch /var/log/audit/audit.log /var/log/audit/audit.log.1
|
2023-06-18 11:40:32 +01:00
|
|
|
- go test ./cmd/... -v -cover -coverprofile=coverage.out
|
|
|
|
- go test ./pkg/... -v -cover -coverprofile=coverage.out
|
2023-01-28 19:44:21 +00:00
|
|
|
- go tool cover -func=coverage.out
|
2021-12-05 00:21:16 +00:00
|
|
|
|
|
|
|
|
2021-04-03 23:30:06 +01:00
|
|
|
# Package Build
|
|
|
|
# -------------
|
|
|
|
|
2023-03-27 23:18:33 +01:00
|
|
|
archlinux:
|
2021-09-27 19:20:27 +01:00
|
|
|
stage: build
|
2023-03-29 00:05:59 +01:00
|
|
|
image: registry.gitlab.com/roddhjav/builders/archlinux
|
2021-04-03 23:30:06 +01:00
|
|
|
script:
|
2023-04-19 18:57:31 +01:00
|
|
|
- sudo pacman -Syu --noconfirm --noprogressbar
|
2021-04-03 23:30:06 +01:00
|
|
|
- makepkg -s --noconfirm --noprogressbar
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- $PKGDEST/*
|
|
|
|
|
2023-03-27 23:18:33 +01:00
|
|
|
debian:
|
2021-09-27 19:20:27 +01:00
|
|
|
stage: build
|
2023-03-29 00:05:59 +01:00
|
|
|
image: registry.gitlab.com/roddhjav/builders/debian
|
2021-04-03 23:30:06 +01:00
|
|
|
script:
|
2023-04-23 23:51:59 +01:00
|
|
|
- sudo chown -R build:build /builds/
|
2023-02-05 00:17:15 +00:00
|
|
|
- git config --global --add safe.directory $CI_PROJECT_DIR
|
2022-10-15 23:37:10 +01:00
|
|
|
- VERSION="0.$(git rev-list --count HEAD)-1"
|
2021-04-03 23:30:06 +01:00
|
|
|
- mkdir -p "$PKGDEST"
|
2023-04-19 18:57:31 +01:00
|
|
|
- sudo apt-get update -q && sudo apt-get install -y config-package-dev rsync
|
2023-04-17 11:26:09 +01:00
|
|
|
- sudo apt-get install -y -t bullseye-backports golang-go
|
2021-04-03 23:30:06 +01:00
|
|
|
- dpkg-buildpackage -b -d --no-sign
|
|
|
|
- mv ../*.deb $PKGDEST/
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- $PKGDEST/*.deb
|
|
|
|
|
2023-03-27 23:38:50 +01:00
|
|
|
ubuntu:
|
2022-10-15 23:37:10 +01:00
|
|
|
extends: debian
|
|
|
|
variables:
|
2023-04-24 00:03:31 +01:00
|
|
|
DISTRIBUTION: ubuntu
|
2022-10-15 23:37:10 +01:00
|
|
|
|
2021-04-03 23:30:06 +01:00
|
|
|
|
|
|
|
# Profile Preprocessing
|
|
|
|
# ---------------------
|
|
|
|
|
2021-09-27 19:20:27 +01:00
|
|
|
preprocess-archlinux:
|
2021-04-03 23:30:06 +01:00
|
|
|
stage: preprocess
|
|
|
|
image: archlinux
|
|
|
|
dependencies:
|
|
|
|
- archlinux
|
|
|
|
script:
|
|
|
|
- pacman -Syu --noconfirm --noprogressbar apparmor
|
2023-04-08 13:09:24 +01:00
|
|
|
- pacman -U --noconfirm --noprogressbar $PKGDEST/*
|
2021-04-03 23:30:06 +01:00
|
|
|
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
|
2021-09-27 19:20:27 +01:00
|
|
|
|
|
|
|
preprocess-debian:
|
|
|
|
stage: preprocess
|
|
|
|
image: debian
|
|
|
|
dependencies:
|
|
|
|
- debian
|
|
|
|
script:
|
|
|
|
- apt-get update -q
|
2021-09-27 20:24:22 +01:00
|
|
|
- apt-get install -y apparmor apparmor-profiles
|
2021-09-27 19:20:27 +01:00
|
|
|
- dpkg --install $PKGDEST/*
|
|
|
|
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
|
2022-10-15 23:37:10 +01:00
|
|
|
|
|
|
|
preprocess-ubuntu:
|
|
|
|
stage: preprocess
|
|
|
|
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-01-29 21:18:22 +00:00
|
|
|
|
2023-03-25 14:38:14 +00:00
|
|
|
preprocess-opensuse:
|
|
|
|
stage: preprocess
|
2023-03-25 15:10:55 +00:00
|
|
|
image: opensuse/tumbleweed
|
2023-03-25 14:38:14 +00:00
|
|
|
script:
|
2023-04-19 18:53:54 +01:00
|
|
|
- zypper install -y apparmor-profiles go git rsync util-linux findutils make
|
2023-03-25 14:38:14 +00:00
|
|
|
- make
|
|
|
|
- make install
|
|
|
|
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
|
|
|
|
|
2023-01-29 21:18:22 +00:00
|
|
|
|
|
|
|
# Deploy the documentation
|
|
|
|
# ------------------------
|
|
|
|
|
|
|
|
pages:
|
|
|
|
stage: deploy
|
|
|
|
image: python
|
2023-05-07 21:23:01 +01:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: clone
|
|
|
|
GIT_DEPTH: 0
|
2023-01-29 21:18:22 +00:00
|
|
|
script:
|
|
|
|
- pip install -r requirements.txt
|
|
|
|
- mkdocs build --verbose --site-dir public
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|