~comcloudway/ccw-aports

dbfc23746df46bd7c4b90e9465c26eba05feb6bc — Jakob Meier 8 months ago ab0016e
CI now pushes to s3 bucket, which is mounted so we only have to build
updated packages
4 files changed, 28 insertions(+), 131 deletions(-)

D .builds/001-check-commit.yml
D .builds/002-build-commit.yml
R .builds/{004-build-all.yml => build-all.yml}
R .builds/{003-check-all.yml => check-all.yml}
D .builds/001-check-commit.yml => .builds/001-check-commit.yml +0 -11
@@ 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

D .builds/002-build-commit.yml => .builds/002-build-commit.yml +0 -78
@@ 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="<yourpassword>"
  - 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

R .builds/004-build-all.yml => .builds/build-all.yml +28 -42
@@ 16,64 16,50 @@ packages:
  - qemu-openrc
  - qemu-x86_64
  # upload dependency
  - rsync
  - s3fs-fuse
environment:
  targets:
    - x86_64
  builddir: ccw-aports
  mirror: ""
  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
  - 6e441cad-ff1f-4ac9-877f-76164952afb6
  - 5cbb7212-a29b-4590-9081-414a45371b60
  # aports pubkey
  - 2314bda9-af3f-40f7-99cf-330595ad006f
  # file containing rsync password. 
  # format: RSYNC_PASSWORD="<yourpassword>"
  - c092726a-e17c-4498-adbf-90cd4771b5eb
  - 3ac2ec05-4f22-4b6a-99cb-f08f7ffe4a29
  # s3fs passwd file
  - 6b490ef3-3359-4999-aed2-6f8c28fc7d26
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 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: |
      if [ ! -f ~/pkglist ]; then
        cd cabin
        cargo build --release
        sudo cargo install --path . --root="/usr"
      fi
      cd cabin
      cargo build --release
      sudo cargo install --path . --root="/usr"
  - index: |
      if [ ! -f ~/pkglist ]; then
        cd $builddir
        cabin scan
      fi
      cd $builddir
      cabin scan
  - 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
        # cabin build-all will automatically generate a tree and order
        # in which to build the dependencies
        cabin build-all -a $target -v
      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
  - cleanup: |
      sudo umount ~/packages

R .builds/003-check-all.yml => .builds/check-all.yml +0 -0