gitlab-ci: make push in "docker" job opt-in

gitlab.com has added pretty small quotas to free tier accounts, and this
job pushes a docker image that is nearly 1GB.  And those rarely get used,
so this makes it opt in via a variable that can be set when manually
running a job, or globally in the "CI/CD Variables" Settings.
This commit is contained in:
Hans-Christoph Steiner 2022-09-08 11:28:59 +02:00
parent 4fc9c309c1
commit dbe4af7951
1 changed files with 5 additions and 0 deletions

View File

@ -580,5 +580,10 @@ docker:
- docker tag $TEST_IMAGE $RELEASE_IMAGE
- docker tag $TEST_IMAGE ${RELEASE_IMAGE}-stretch
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
# This avoids filling up gitlab.com free tier accounts with unused docker images.
- echo "Skipping docker push to save quota on your gitlab namespace."
- echo "If you want to enable the push, set FDROID_PUSH_DOCKER_IMAGE in"
- echo "https://gitlab.com/$CI_PROJECT_NAMESPACE/fdroidserver/-/settings/ci_cd#js-cicd-variables-settings"
- test -n "$FDROID_PUSH_DOCKER_IMAGE" || exit 0
- docker push $RELEASE_IMAGE
- docker push $RELEASE_IMAGE-stretch