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/packages
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
# Code Linter
|
|
|
|
# -----------
|
|
|
|
|
|
|
|
bash:
|
|
|
|
stage: lint
|
|
|
|
image: koalaman/shellcheck-alpine
|
|
|
|
script:
|
|
|
|
- shellcheck --shell=bash
|
2021-12-05 20:17:53 +01:00
|
|
|
PKGBUILD configure pick
|
2021-04-04 00:30:06 +02:00
|
|
|
debian/apparmor.d.postinst debian/apparmor.d.postrm
|
|
|
|
|
2021-11-09 23:41:12 +01:00
|
|
|
golangci-lint:
|
|
|
|
stage: lint
|
|
|
|
image: golangci/golangci-lint
|
|
|
|
script:
|
2021-11-23 21:20:06 +01:00
|
|
|
- golangci-lint run
|
2021-11-09 23:41:12 +01:00
|
|
|
|
2022-10-06 21:55:35 +02:00
|
|
|
hadolint:
|
|
|
|
stage: lint
|
|
|
|
image: hadolint/hadolint:latest-alpine
|
|
|
|
script:
|
|
|
|
- hadolint dists/build/*/Dockerfile
|
|
|
|
|
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
|
|
|
|
script:
|
2022-10-15 23:05:52 +02:00
|
|
|
- cp tests/journalctl /usr/bin/journalctl
|
|
|
|
- chmod 755 /usr/bin/journalctl
|
2021-12-05 01:21:16 +01:00
|
|
|
- go test ./cmd/aa-log -v -cover
|
|
|
|
|
|
|
|
|
2021-04-04 00:30:06 +02:00
|
|
|
# Package Build
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
archlinux:
|
2021-09-27 20:20:27 +02:00
|
|
|
stage: build
|
2022-07-22 13:09:07 +02:00
|
|
|
image: registry.gitlab.com/archlex/packages/builders/archlinux
|
2021-04-04 00:30:06 +02:00
|
|
|
script:
|
2021-12-05 01:23:49 +01:00
|
|
|
- sudo pacman -Syu --noconfirm --noprogressbar lsb-release
|
2021-04-04 00:30:06 +02:00
|
|
|
- makepkg -s --noconfirm --noprogressbar
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- $PKGDEST/*
|
|
|
|
|
|
|
|
debian:
|
2021-09-27 20:20:27 +02:00
|
|
|
stage: build
|
2021-04-04 00:30:06 +02:00
|
|
|
image: registry.gitlab.com/archlex/packages/builders/debian
|
|
|
|
script:
|
|
|
|
- VERSION="$(date +%y.%m%d)-1"
|
|
|
|
- mkdir -p "$PKGDEST"
|
2022-10-16 00:14:09 +02:00
|
|
|
- sudo apt-get update -q && sudo apt-get install -y golang-go lsb-release rsync
|
2021-04-04 00:30:06 +02:00
|
|
|
- dch --newversion=$VERSION --urgency=medium --distribution=stable --controlmaint "Release $VERSION"
|
|
|
|
- dpkg-buildpackage -b -d --no-sign
|
|
|
|
- mv ../*.deb $PKGDEST/
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- $PKGDEST/*.deb
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
2021-08-22 17:02:07 +02:00
|
|
|
- pacman -U --noconfirm --noprogressbar
|
|
|
|
--overwrite etc/apparmor.d/tunables/global
|
|
|
|
--overwrite etc/apparmor.d/tunables/xdg-user-dirs
|
2022-09-06 18:56:29 +02:00
|
|
|
--overwrite etc/apparmor.d/abstractions/trash
|
2021-08-22 17:02:07 +02:00
|
|
|
$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
|