Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 10:46:10 +01:00
forgejo/releases/container-images-pull-verify-push-test.sh

71 lines
2 KiB
Bash
Raw Normal View History

[CI] Woodpecker based releases process (cherry picked from commit c2a7aaeee82293793b2740251dc5fd27dfb32ddb) (cherry picked from commit 6b6007fbced1cecb15aeb09e709b23855c43177e) (cherry picked from commit 63608a221e551a0e1822901be62f37a557622edd) (cherry picked from commit 5cfe60baa7a3d250458a8b562976f605357c806b) (cherry picked from commit 2af4c73d12a13ac5e0cd9bb02ff4195e3d88c47c) (cherry picked from commit 1985959bfea6df1cb965dc0a963d8fb49eddc2f3) (cherry picked from commit 880424c77ee46f7cfabccbf8eb546a66e05c0e1c) (cherry picked from commit c78a861d1bccc92df94ef01157ee3828b960063e) (cherry picked from commit 25c122701130c3cfce1e11e88ba0d0de8bc32dad) (cherry picked from commit 7195e894ee0dd348b02b034a0821c52f055c0eb9) (cherry picked from commit cf15153873f6007d233811faf171d0828461152b) (cherry picked from commit 9bee773c95298a65ad0df2e17eb11270b61191b6) (cherry picked from commit 581c3060da3561569c9b03c6931064b55438944c) (cherry picked from commit bf550f9b2c6fb09fba02c5884cf1206024780149) (cherry picked from commit b570eca0b950e94dc78a91b57391ed031dccefd4) [CI] implementation: Woodpecker based CI (squash) Upgrade xgo to Go v1.20 for building binaries (cherry picked from commit 6308c776b6e8fb8a904d08b178f61a7dab1ef971) [CI] v1.20: switch PR check from Woodpecker CI to Forgejo Actions The PR checks for v1.19 still rely on Woodpecker CI. Keeping .woodpecker in v1.20 while both Woodpecker CI & Forgejo Actions are enabled would dupicate the checks. The release process in releases remains Woodpecker CI. (cherry picked from commit 93e42f3f53da1084db21b354994449a32e4abca4) (cherry picked from commit 599c5162ad069fa5cb239a91486152cd47c77bf7) (cherry picked from commit 6f8b723a55277c1e15827dcdfaa9a0ffe3ea42b4) (cherry picked from commit e238d7d72fd5aa9741e9c5e76f37f5aff8db2892) (cherry picked from commit 2258fb575bb6793887c46a0243766a34ed24256e)
2022-11-05 00:00:07 +01:00
#!/bin/sh
set -ex
image_delete() {
curl -sS -H @$TOKEN_HEADER -X DELETE https://$DOMAIN/v2/$1/forgejo/manifests/$2
}
#
# Create the same set of images that buildx would
#
test_setup() {
dir=$(dirname $0)
for suffix in '' '-rootless' ; do
(
cd $dir
manifests=""
for arch in $ARCHS ; do
image=$(arch_image_name $PULL_USER $arch $suffix)
docker build -f Dockerfile$suffix --platform linux/$arch -t $image .
docker push $image
images="$images $image"
done
manifest=$(image_name $PULL_USER $suffix)
docker manifest rm $manifest || true
docker manifest create $manifest $images
image_put $PULL_USER $(image_tag $suffix) $manifest
)
done
}
test_teardown() {
authenticate
for suffix in '' '-rootless' ; do
image_delete $PULL_USER $(image_tag $suffix)
image_delete $PUSH_USER $(image_tag $suffix)
image_delete $PUSH_USER $(short_image_tag $suffix)
for arch in $ARCHS ; do
image_delete $PULL_USER $(arch_image_tag $arch $suffix)
image_delete $PUSH_USER $(arch_image_tag $arch $suffix)
done
done
}
#
# Running the test locally instead of within Woodpecker
#
# 1. Setup: obtain a token at https://codeberg.org/user/settings/applications
# 2. Run: RELEASETEAMUSER=<username> RELEASETEAMTOKEn=<apptoken> container-images-pull-verify-push-test.sh test_run
# 3. Verify: (optional) manual verification at https://codeberg.org/<username>/-/packages/container/forgejo/versions
# 4. Cleanup: RELEASETEAMUSER=<username> RELEASETEAMTOKEn=<apptoken> container-images-pull-verify-push-test.sh test_teardown
#
test_run() {
boot
test_teardown
test_setup
VERIFY_STRING=something
VERIFY_COMMAND="echo $VERIFY_STRING"
echo "================================ TEST BEGIN"
main
echo "================================ TEST END"
}
: ${CI_REPO_OWNER:=dachary}
: ${PULL_USER:=$CI_REPO_OWNER}
: ${PUSH_USER:=$CI_REPO_OWNER}
: ${CI_COMMIT_TAG:=v17.1.42-2}
. $(dirname $0)/container-images-pull-verify-push.sh