From dbfc23746df46bd7c4b90e9465c26eba05feb6bc Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 4 Jan 2024 17:38:54 +0100 Subject: [PATCH] CI now pushes to s3 bucket, which is mounted so we only have to build updated packages --- .builds/001-check-commit.yml | 11 --- .builds/002-build-commit.yml | 78 ------------------- .builds/004-build-all.yml | 79 -------------------- .builds/build-all.yml | 65 ++++++++++++++++ .builds/{003-check-all.yml => check-all.yml} | 0 5 files changed, 65 insertions(+), 168 deletions(-) delete mode 100644 .builds/001-check-commit.yml delete mode 100644 .builds/002-build-commit.yml delete mode 100644 .builds/004-build-all.yml create mode 100644 .builds/build-all.yml rename .builds/{003-check-all.yml => check-all.yml} (100%) diff --git a/.builds/001-check-commit.yml b/.builds/001-check-commit.yml deleted file mode 100644 index d3562bb..0000000 --- a/.builds/001-check-commit.yml +++ /dev/null @@ -1,11 +0,0 @@ -image: alpine/edge -packages: - - atools -tasks: - - prepare: | - touch ~/pkglist - if [ ! "$GIT_REF" = "" ] && [ ! "$(echo $GIT_REF | cut -d'/' -f'2')" = "tags" ]; then - git diff --name-only $GIT_REF~ $GIT_REF | grep APKBUILD | cut -d'/' -f 2 > ~/pkglist - fi - - check: | - cat ~/pkglist | xargs -n 1 apkbuild-lint diff --git a/.builds/002-build-commit.yml b/.builds/002-build-commit.yml deleted file mode 100644 index 31e7188..0000000 --- a/.builds/002-build-commit.yml +++ /dev/null @@ -1,78 +0,0 @@ -image: alpine/edge -repositories: - ccw.icu: > - /home/build/packages - https://git.hut.ccw.icu/~comcloudway/ccw-aports/blob/main/comcloudway%40ccw.icu.rsa.pub - comcloudway@ccw.icu.rsa.pub -packages: - # prepare dependency - - git - # setup dependency - - cargo - # build dependency - - abuild - - abuild-rootbld - - qemu - - qemu-openrc - - qemu-x86_64 - # upload dependency - - rsync -environment: - targets: - - x86_64 - builddir: ccw-aports - mirror: "" -sources: - - https://git.hut.ccw.icu/~comcloudway/ccw-aports - - https://git.hut.ccw.icu/~comcloudway/cabin -secrets: - # aports privkey - - 6e441cad-ff1f-4ac9-877f-76164952afb6 - # aports pubkey - - 2314bda9-af3f-40f7-99cf-330595ad006f - # file containing rsync password. - # format: RSYNC_PASSWORD="" - - c092726a-e17c-4498-adbf-90cd4771b5eb -tasks: - - prepare: | - cd $builddir - # detect changed packages - # build all if undetected - if [ ! "$GIT_REF" = "" ] && [ ! "$(echo $GIT_REF | cut -d'/' -f'2')" = "tags" ]; then - git diff --name-only $GIT_REF~ $GIT_REF | grep APKBUILD | cut -d'/' -f 2 > ~/pkglist - # configure keypath - echo 'PACKAGER_PRIVKEY=$HOME/.abuild/comcloudway@ccw.icu.rsa' >> $HOME/.abuild/abuild.conf - # start binfmt service for userspace emulation - # required by abuild-rootbld - sudo rc-service qemu-binfmt start - fi - - setup: | - if [ -f ~/pkglist ]; then - cd cabin - cargo build --release - sudo cargo install --path . --root="/usr" - fi - - index: | - if [ -f ~/pkglist ]; then - cd $builddir - cabin scan - fi - - build: | - if [ -f ~/pkglist ]; then - cd $builddir - for target in "${targets[@]}" - do - # cabin build-group will automatically generate a tree and order - # in which to build the dependencies - cat ~/pkglist | xargs cabin build-group -a $target -v - done - fi - - upload: | - if [ -f ~/pkglist ]; then - set +x # hide secret - set -a # load variable from file even without export - source ~/.rsyncpass - set +a - set -x - rsync -Irtlzv /home/builder/packages/* $mirror - fi diff --git a/.builds/004-build-all.yml b/.builds/004-build-all.yml deleted file mode 100644 index 8e12cd4..0000000 --- a/.builds/004-build-all.yml +++ /dev/null @@ -1,79 +0,0 @@ -image: alpine/edge -repositories: - ccw.icu: > - /home/build/packages - https://git.hut.ccw.icu/~comcloudway/ccw-aports/blob/main/comcloudway%40ccw.icu.rsa.pub - comcloudway@ccw.icu.rsa.pub -packages: - # prepare dependency - - git - # setup dependency - - cargo - # build dependency - - abuild - - abuild-rootbld - - qemu - - qemu-openrc - - qemu-x86_64 - # upload dependency - - rsync -environment: - targets: - - x86_64 - builddir: ccw-aports - mirror: "" -sources: - - https://git.hut.ccw.icu/~comcloudway/ccw-aports - - https://git.hut.ccw.icu/~comcloudway/cabin -secrets: - # aports privkey - - 6e441cad-ff1f-4ac9-877f-76164952afb6 - # aports pubkey - - 2314bda9-af3f-40f7-99cf-330595ad006f - # file containing rsync password. - # format: RSYNC_PASSWORD="" - - c092726a-e17c-4498-adbf-90cd4771b5eb -tasks: - - prepare: | - cd $builddir - # detect changed packages - # build all if undetected - if [ ! "$GIT_REF" = "" ] && [ ! "$(echo $GIT_REF | cut -d'/' -f'2')" = "tags" ]; then - git diff --name-only $GIT_REF~ $GIT_REF | grep APKBUILD | cut -d'/' -f 2 > ~/pkglist - else - # configure keypath - echo 'PACKAGER_PRIVKEY=$HOME/.abuild/comcloudway@ccw.icu.rsa' >> $HOME/.abuild/abuild.conf - # start binfmt service for userspace emulation - # required by abuild-rootbld - sudo rc-service qemu-binfmt start - fi - - setup: | - if [ ! -f ~/pkglist ]; then - cd cabin - cargo build --release - sudo cargo install --path . --root="/usr" - fi - - index: | - if [ ! -f ~/pkglist ]; then - cd $builddir - cabin scan - fi - - build: | - cd $builddir - for target in "${targets[@]}" - do - if [ ! -f ~/pkglist ]; then - # cabin build-all will automatically generate a tree and order - # in which to build the dependencies - cabin build-all -a $target -v - fi - done - - upload: | - if [ ! -f ~/pkglist ]; then - set +x # hide secret - set -a # load variable from file even without export - source ~/.rsyncpass - set +a - set -x - rsync -Irtlzv /home/builder/packages/* $mirror - fi diff --git a/.builds/build-all.yml b/.builds/build-all.yml new file mode 100644 index 0000000..40b8ca9 --- /dev/null +++ b/.builds/build-all.yml @@ -0,0 +1,65 @@ +image: alpine/edge +repositories: + ccw.icu: > + /home/build/packages + https://git.hut.ccw.icu/~comcloudway/ccw-aports/blob/main/comcloudway%40ccw.icu.rsa.pub + comcloudway@ccw.icu.rsa.pub +packages: + # prepare dependency + - git + # setup dependency + - cargo + # build dependency + - abuild + - abuild-rootbld + - qemu + - qemu-openrc + - qemu-x86_64 + # upload dependency + - s3fs-fuse +environment: + targets: + - x86_64 + builddir: ccw-aports + mirror: "https://s3.ccw.icu" + mirror_bucket: "mirror" + owner: "comcloudway@ccw.icu" +sources: + - https://git.hut.ccw.icu/~comcloudway/ccw-aports + - https://git.hut.ccw.icu/~comcloudway/cabin +secrets: + # aports privkey + - 5cbb7212-a29b-4590-9081-414a45371b60 + # aports pubkey + - 3ac2ec05-4f22-4b6a-99cb-f08f7ffe4a29 + # s3fs passwd file + - 6b490ef3-3359-4999-aed2-6f8c28fc7d26 +tasks: + - prepare: | + # setup s3fs + sudo modprobe fuse + sudo mv ~/.passwd-s3fs /etc/passwd-s3fs + mkdir -p ~/packages + sudo s3fs $mirror_bucket ~/packages -o url=$mirror -o use_path_request_style -o umask=0007,uid=$(id -u) -o allow_other + # configure keypath + echo 'PACKAGER_PRIVKEY=$HOME/.abuild/$owner.rsa' >> $HOME/.abuild/abuild.conf + # start binfmt service for userspace emulation + # required by abuild-rootbld + sudo rc-service qemu-binfmt start + - setup: | + cd cabin + cargo build --release + sudo cargo install --path . --root="/usr" + - index: | + cd $builddir + cabin scan + - build: | + cd $builddir + for target in "${targets[@]}" + do + # cabin build-all will automatically generate a tree and order + # in which to build the dependencies + cabin build-all -a $target -v + done + - cleanup: | + sudo umount ~/packages diff --git a/.builds/003-check-all.yml b/.builds/check-all.yml similarity index 100% rename from .builds/003-check-all.yml rename to .builds/check-all.yml -- 2.38.5