gitlab-ci: use BASEBRANCH to set repository and match to release
This commit is contained in:
parent
5e06b87d62
commit
a57e703a79
2 changed files with 42 additions and 32 deletions
|
@ -7,7 +7,7 @@
|
|||
set -eu -o pipefail
|
||||
|
||||
readonly APORTSDIR=$CI_PROJECT_DIR
|
||||
readonly REPOS="qubes-aports"
|
||||
readonly REPOS="qubes/r4.1"
|
||||
readonly ALPINE_REPOS="main community testing"
|
||||
readonly ARCH=$(apk --print-arch)
|
||||
# gitlab variables
|
||||
|
@ -78,6 +78,14 @@ get_release() {
|
|||
esac
|
||||
}
|
||||
|
||||
get_qubes_release() {
|
||||
case $BASEBRANCH in
|
||||
r*) echo $BASEBRANCH;;
|
||||
master) echo r4.2;;
|
||||
*) die "Branch \"$BASEBRANCH\" not supported!"
|
||||
esac
|
||||
}
|
||||
|
||||
build_aport() {
|
||||
local repo="$1" aport="$2"
|
||||
cd "$APORTSDIR/$aport"
|
||||
|
@ -103,10 +111,7 @@ set_repositories_for() {
|
|||
local release
|
||||
|
||||
release=$(get_release)
|
||||
for repo in $REPOS; do
|
||||
repos="$repos $MIRROR/$release/$repo $REPODEST/$repo"
|
||||
[ "$repo" = "$target_repo" ] && break
|
||||
done
|
||||
repos="$MIRROR/$release/qubes/$target_repo $REPODEST/qubes-aports"
|
||||
sudo sh -c "printf '%s\n' $repos >> /etc/apk/repositories"
|
||||
sudo apk update || true
|
||||
}
|
||||
|
@ -208,35 +213,33 @@ section_end setup
|
|||
build_start=$CI_ALPINE_BUILD_OFFSET
|
||||
build_limit=$CI_ALPINE_BUILD_LIMIT
|
||||
|
||||
for repo in qubes-aports; do
|
||||
mkdir -p "$APORTSDIR"/logs "$APORTSDIR"/packages "$APORTSDIR"/keys
|
||||
set_repositories_for "$repo"
|
||||
built_aports=0
|
||||
changed_aports_in_repo=$(changed_aports $BASEBRANCH)
|
||||
changed_aports_in_repo_count=$(echo "$changed_aports_in_repo" | wc -l)
|
||||
changed_aports_to_build=$(echo "$changed_aports_in_repo" | apply_offset_limit "$build_start" "$build_limit")
|
||||
mkdir -p "$APORTSDIR"/logs "$APORTSDIR"/packages "$APORTSDIR"/keys
|
||||
set_repositories_for $(get_qubes_release)
|
||||
built_aports=0
|
||||
changed_aports_in_repo=$(changed_aports $BASEBRANCH)
|
||||
changed_aports_in_repo_count=$(echo "$changed_aports_in_repo" | wc -l)
|
||||
changed_aports_to_build=$(echo "$changed_aports_in_repo" | apply_offset_limit "$build_start" "$build_limit")
|
||||
|
||||
msg "Changed aports in $repo:"
|
||||
# shellcheck disable=SC2086 # Splitting is expected here
|
||||
printf " - %s\n" $changed_aports_to_build
|
||||
for pkgname in $changed_aports_to_build; do
|
||||
section_start "build_$pkgname" "Building package $pkgname"
|
||||
built_aports=$((built_aports+1))
|
||||
if check_aport "$repo" "$pkgname"; then
|
||||
build_aport "$repo" "$pkgname"
|
||||
fi
|
||||
section_end "build_$pkgname"
|
||||
done
|
||||
|
||||
build_start=$((build_start-(changed_aports_in_repo_count-built_aports)))
|
||||
build_limit=$((build_limit-built_aports))
|
||||
|
||||
if [ $build_limit -le 0 ]; then
|
||||
msg "Limit reached, breaking"
|
||||
break
|
||||
msg "Changed aports:"
|
||||
# shellcheck disable=SC2086 # Splitting is expected here
|
||||
printf " - %s\n" $changed_aports_to_build
|
||||
for pkgname in $changed_aports_to_build; do
|
||||
section_start "build_$pkgname" "Building package $pkgname"
|
||||
built_aports=$((built_aports+1))
|
||||
if check_aport qubes-aports "$pkgname"; then
|
||||
build_aport qubes-aports "$pkgname"
|
||||
fi
|
||||
section_end "build_$pkgname"
|
||||
done
|
||||
|
||||
build_start=$((build_start-(changed_aports_in_repo_count-built_aports)))
|
||||
build_limit=$((build_limit-built_aports))
|
||||
|
||||
if [ $build_limit -le 0 ]; then
|
||||
msg "Limit reached, breaking"
|
||||
break
|
||||
fi
|
||||
|
||||
section_start artifacts "Handeling artifacts" collapse
|
||||
copy_artifacts || true
|
||||
section_end artifacts
|
||||
|
|
|
@ -33,8 +33,15 @@ else
|
|||
git clone git@lab.ilot.io:ayakael/repo-apk -b $ALPINE_RELEASE $HOME/repo-apk
|
||||
fi
|
||||
|
||||
# TODO: Detect qubes release
|
||||
QUBES_REL=r41
|
||||
get_qubes_release() {
|
||||
case $BASEBRANCH in
|
||||
r*) echo $BASEBRANCH;;
|
||||
master) echo r4.2;;
|
||||
*) die "Branch \"$BASEBRANCH\" not supported!"
|
||||
esac
|
||||
}
|
||||
|
||||
QUBES_REL=$(get_qubes_release)
|
||||
|
||||
for i in $(find packages -type f -name "*.apk"); do
|
||||
install -vDm644 $i ${i/packages\/qubes-aports/$HOME\/repo-apk\/qubes\/$QUBES_REL}
|
||||
|
|
Loading…
Reference in a new issue