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