diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92045d1b..9765bba8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -101,6 +101,18 @@ ubuntu: variables: DISTRIBUTION: ubuntu +opensuse: + stage: build + image: registry.gitlab.com/roddhjav/builders/opensuse + script: + - mkdir -p "$PKGDEST" + - sudo zypper install -y distribution-release golang-packaging rsync + - bash dists/build.sh rpm + artifacts: + expire_in: 1 day + paths: + - $PKGDEST/*.rpm + # Profile Preprocessing # --------------------- @@ -140,10 +152,11 @@ preprocess-ubuntu: preprocess-opensuse: stage: preprocess image: opensuse/tumbleweed + dependencies: + - opensuse script: - - zypper install -y apparmor-profiles go git rsync util-linux findutils make - - make - - make install + - zypper install -y apparmor-profiles + - rpm -i $PKGDEST/* - apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null diff --git a/dists/build.sh b/dists/build.sh index 6ac76587..f38c5b2c 100644 --- a/dists/build.sh +++ b/dists/build.sh @@ -8,6 +8,7 @@ set -eu -o pipefail readonly COMMAND="$1" +readonly OUTPUT="${PKGDEST:-$PWD}" readonly PKGNAME=apparmor.d VERSION="0.$(git rev-list --count HEAD)" readonly VERSION @@ -21,14 +22,13 @@ main() { dpkg) dch --newversion="$VERSION-1" --urgency=medium --distribution=stable --controlmaint "Release $VERSION-1" dpkg-buildpackage -b -d --no-sign - mv ../"${PKGNAME}_${VERSION}-1"_*.deb . + mv ../"${PKGNAME}_${VERSION}-1"_*.deb "$OUTPUT" ;; rpm) RPMBUILD_ROOT=$(mktemp -d) - OUTPUT_DIR=$(pwd) ARCH=$(uname -m) - readonly RPMBUILD_ROOT ARCH OUTPUT_DIR + readonly RPMBUILD_ROOT ARCH mkdir -p "$RPMBUILD_ROOT"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS/tmp} cp -p "dists/$PKGNAME.spec" "$RPMBUILD_ROOT/SPECS" @@ -38,7 +38,7 @@ main() { sed -i "s/^Version:.*/Version: $VERSION/" "SPECS/$PKGNAME.spec" rpmbuild -bb --define "_topdir $RPMBUILD_ROOT" "SPECS/$PKGNAME.spec" - cp "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT_DIR" + cp "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT" rm -rf "$RPMBUILD_ROOT" ;;