gitlab-ci: enable s390x and ppc64le runners

This commit is contained in:
Antoine Martin 2023-08-13 00:27:00 -04:00
parent 2f7f2d81f5
commit 1215578116
Signed by: forge
GPG key ID: D62A472A4AA7D541
4 changed files with 38 additions and 27 deletions

View file

@ -12,22 +12,22 @@ lint:
interruptible: true interruptible: true
script: script:
- | - |
sudo apk add shellcheck atools doas abuild sudo apk add shellcheck atools sudo abuild
export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin" export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin"
lint lint
allow_failure: true allow_failure: true
only: only:
- merge_requests - merge_requests
tags: tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME - apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-x86_64
.build: .build:
stage: build stage: build
interruptible: true interruptible: true
script: script:
- | - |
sudo apk add alpine-sdk lua-aports doas sudo apk add alpine-sdk lua-aports sudo
doas addgroup $USER abuild sudo addgroup $USER abuild
export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin" export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin"
sudo -Eu $USER build.sh sudo -Eu $USER build.sh
artifacts: artifacts:
@ -36,19 +36,16 @@ lint:
- keys/ - keys/
- logs/ - logs/
expire_in: 7 days expire_in: 7 days
when: always
only: only:
- merge_requests - merge_requests
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
.cross: .cross:
stage: build stage: build
interruptible: true interruptible: true
script: script:
- | - |
sudo apk add alpine-sdk lua-aports doas gzip xz qemu-$CI_QEMU_TARGET_ARCH sudo apk add alpine-sdk lua-aports sudo gzip xz qemu-$CI_QEMU_TARGET_ARCH
doas addgroup $USER abuild sudo addgroup $USER abuild
export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin" export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin"
build-rootfs.sh alpine${CI_MERGE_REQUEST_TARGET_BRANCH_NAME/v} $CI_ALPINE_TARGET_ARCH --rootfsdir $HOME/sysroot-$CI_ALPINE_TARGET_ARCH build-rootfs.sh alpine${CI_MERGE_REQUEST_TARGET_BRANCH_NAME/v} $CI_ALPINE_TARGET_ARCH --rootfsdir $HOME/sysroot-$CI_ALPINE_TARGET_ARCH
cp /etc/apk/repositories $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/. cp /etc/apk/repositories $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/.
@ -59,18 +56,32 @@ lint:
- keys/ - keys/
- logs/ - logs/
expire_in: 7 days expire_in: 7 days
when: always
when: manual
only: only:
- merge_requests - merge_requests
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
build-x86_64: build-x86_64:
extends: .build extends: .build
when: always
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-x86_64
build-ppc64le:
extends: .build
when: manual
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-ppc64le
build-s390x:
extends: .build
when: manual
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-s390x
build-armv7: build-armv7:
extends: .cross extends: .cross
when: manual
tags:
- apk-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-x86_64
variables: variables:
CI_ALPINE_TARGET_ARCH: armv7 CI_ALPINE_TARGET_ARCH: armv7
CI_QEMU_TARGET_ARCH: arm CI_QEMU_TARGET_ARCH: arm

View file

@ -113,12 +113,12 @@ set_repositories_for() {
repos="$repos $MIRROR/$release/$repo $REPODEST/$repo" repos="$repos $MIRROR/$release/$repo $REPODEST/$repo"
[ "$repo" = "$target_repo" ] && break [ "$repo" = "$target_repo" ] && break
done done
doas sh -c "printf '%s\n' $repos >> /etc/apk/repositories" sudo sh -c "printf '%s\n' $repos >> /etc/apk/repositories"
doas apk update || true sudo apk update || true
if [ "$CI_ALPINE_TARGET_ARCH" != "$ARCH" ]; then if [ "$CI_ALPINE_TARGET_ARCH" != "$ARCH" ]; then
doas sh -c "printf '%s\n' $repos >> $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/repositories" sudo sh -c "printf '%s\n' $repos >> $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/repositories"
doas cp -R /etc/apk/keys/* $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/keys/. sudo cp -R /etc/apk/keys/* $HOME/sysroot-$CI_ALPINE_TARGET_ARCH/etc/apk/keys/.
doas apk --root=$HOME/sysroot-$CI_ALPINE_TARGET_ARCH update || true sudo apk --root=$HOME/sysroot-$CI_ALPINE_TARGET_ARCH update || true
fi fi
} }
@ -140,21 +140,21 @@ setup_system() {
repos="$repos $ALPINE_MIRROR/$release/$repo" repos="$repos $ALPINE_MIRROR/$release/$repo"
done done
repos="$repos $MIRROR/$release/cross" repos="$repos $MIRROR/$release/cross"
doas sh -c "printf '%s\n' $repos > /etc/apk/repositories" sudo sh -c "printf '%s\n' $repos > /etc/apk/repositories"
doas apk -U upgrade -a || doas apk fix || die "Failed to up/downgrade system" sudo apk -U upgrade -a || sudo apk fix || die "Failed to up/downgrade system"
if [ "$CI_ALPINE_TARGET_ARCH" != "$ARCH" ]; then if [ "$CI_ALPINE_TARGET_ARCH" != "$ARCH" ]; then
doas apk add gcc-$CI_ALPINE_TARGET_ARCH sudo apk add gcc-$CI_ALPINE_TARGET_ARCH
fi fi
gitlab_key_to_rsa $ABUILD_KEY rsa-private $HOME/.abuild/$ABUILD_KEY_NAME.rsa gitlab_key_to_rsa $ABUILD_KEY rsa-private $HOME/.abuild/$ABUILD_KEY_NAME.rsa
gitlab_key_to_rsa $ABUILD_KEY_PUB rsa-public $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub gitlab_key_to_rsa $ABUILD_KEY_PUB rsa-public $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub
chmod 700 $HOME/.abuild/$ABUILD_KEY_NAME.rsa chmod 700 $HOME/.abuild/$ABUILD_KEY_NAME.rsa
echo "PACKAGER_PRIVKEY=$HOME/.abuild/$ABUILD_KEY_NAME.rsa" >> $HOME/.abuild/abuild.conf echo "PACKAGER_PRIVKEY=$HOME/.abuild/$ABUILD_KEY_NAME.rsa" >> $HOME/.abuild/abuild.conf
doas cp $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub /etc/apk/keys/$ABUILD_KEY_NAME.rsa.pub sudo cp $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub /etc/apk/keys/$ABUILD_KEY_NAME.rsa.pub
# patch abuild for crosscompiling # patch abuild for crosscompiling
doas patch -p1 -d / -i $CI_PROJECT_DIR/.gitlab/patches/abuild-cross.patch sudo patch -p1 -d / -i $CI_PROJECT_DIR/.gitlab/patches/abuild-cross.patch
doas sed -i -E 's/export JOBS=[0-9]+$/export JOBS=$(nproc)/' /etc/abuild.conf sudo sed -i -E 's/export JOBS=[0-9]+$/export JOBS=$(nproc)/' /etc/abuild.conf
( . /etc/abuild.conf && echo "Building with $JOBS jobs" ) ( . /etc/abuild.conf && echo "Building with $JOBS jobs" )
mkdir -p "$REPODEST" mkdir -p "$REPODEST"
git config --global init.defaultBranch master git config --global init.defaultBranch master
@ -203,7 +203,7 @@ sysinfo || true
setup_system || die "Failed to setup system" setup_system || die "Failed to setup system"
# git no longer allows to execute in repositories owned by different users # git no longer allows to execute in repositories owned by different users
doas chown -R $USER: . sudo chown -R $USER: .
fetch_flags="-qn" fetch_flags="-qn"
debugging && fetch_flags="-v" debugging && fetch_flags="-v"

View file

@ -23,7 +23,7 @@ debug() {
} }
# git no longer allows to execute in repositories owned by different users # git no longer allows to execute in repositories owned by different users
doas chown -R gitlab-runner: . sudo chown -R gitlab-runner: .
fetch_flags="-qn" fetch_flags="-qn"
debugging && fetch_flags="-v" debugging && fetch_flags="-v"

View file

@ -21,7 +21,7 @@ chmod 700 "$HOME"/.abuild/$ABUILD_KEY_NAME.rsa
echo "PACKAGER_PRIVKEY=$HOME/.abuild/$ABUILD_KEY_NAME.rsa" > $HOME/.abuild/abuild.conf echo "PACKAGER_PRIVKEY=$HOME/.abuild/$ABUILD_KEY_NAME.rsa" > $HOME/.abuild/abuild.conf
echo "REPODEST=$HOME/repo-apk" >> $HOME/.abuild/abuild.conf echo "REPODEST=$HOME/repo-apk" >> $HOME/.abuild/abuild.conf
doas cp $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub /etc/apk/keys/. sudo cp $HOME/.abuild/$ABUILD_KEY_NAME.rsa.pub /etc/apk/keys/.
if [ -d $HOME/repo-apk ]; then if [ -d $HOME/repo-apk ]; then
git -C $HOME/repo-apk fetch git -C $HOME/repo-apk fetch