end-to-end/packages/alpine-7.0/test.sh
Earl Warren 427c46dbf9
lib: remove RELEASE_NUMBERS_AND_DEV, use RELEASE_NUMBERS
In the lifecycle of vX.Y.Z, all tests are run against vX.Y-test
before it is published, including when the tag is pushed because the
automated release process now runs end-to-end before pushing the
release to forgejo-experimental.

Running end-to-end against vX.Y-dev is therefore redundant with at least
two other runs with exactly the same SHA (the one before the tag is
pushed and the one when the tag is pushed). There would be value in
doing that if it allowed to detect race conditions in Forgejo. But
such races were not found in the past six months and there is a lot
more scrutiny on commits merged in Forgejo which makes it even less
likely than it was before.

Running the tests on vX.Y instead of also including the built version
provide the same coverage and reduces the workload.
2024-08-08 17:46:04 +02:00

63 lines
2.1 KiB
Bash
Executable file

#!/bin/busybox ash
set -exuo pipefail
forgejo_url=$1
forgejo_token=$2
# initialize abuild
apk update
apk add --no-cache alpine-sdk sudo util-linux curl
adduser -D user -h /home/user
addgroup user abuild
echo "root ALL=(ALL) ALL" >/etc/sudoers
echo "%abuild ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
mkdir -p /var/cache/distfiles
chgrp abuild /var/cache/distfiles
chmod 775 /var/cache/distfiles
mkdir -p "/home/user/.abuild"
echo "/home/user/.abuild/user.rsa" | abuild-keygen -i -b 4096
echo 'PACKAGER_PRIVKEY=/home/user/.abuild/user.rsa' >/home/user/.abuild/abuild.conf
chown -R "user:user" /home/user/
# make sure we own the relevant directory
cp -r package-source /srv/alpine
cd /srv
mkdir packages
echo "REPODEST=/srv/packages" >>/home/user/.abuild/abuild.conf
cat /home/user/.abuild/abuild.conf
chown -R user:user alpine packages
# build the package
sudo -u user APKBUILD=alpine/forgejo-2174/APKBUILD abuild -r
# build the package
sudo -u user APKBUILD=alpine/forgejo-2173/APKBUILD abuild -r
# upload new package
cd packages/alpine/x86_64/
for file in $(find . -name '*.apk' -type f | sed -e 's,./,,'); do
# remove old package
curl \
--fail \
-H "Authorization: token $forgejo_token" \
-X DELETE \
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests/$file" ||
true
# upload new package
curl \
--fail \
-H "Authorization: token $forgejo_token" \
-T "$file" \
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests"
done
# ensure that the install-if condition works as expected
apk add openrc
(cd /etc/apk/keys && curl -JO $forgejo_url/api/packages/root/alpine/key)
echo "$forgejo_url/api/packages/root/alpine/3.19/e2e-tests" >>/etc/apk/repositories
apk add forgejo-2174 forgejo-2173
[ -e /usr/bin/forgejo_2174 ] # from the installed package
[ -e /usr/bin/forgejo_2173 ] # from the installed package
[ -e /etc/init.d/forgejo_2174 ] # from the -openrc package installed because of the install-if condition
[ -e /etc/init.d/forgejo_2173 ] # from the -openrc package installed because of the install-if condition