From fc44e7f072aa0b9b7f5341069e8b678e34359877 Mon Sep 17 00:00:00 2001 From: paulfantom Date: Mon, 14 Sep 2020 16:31:22 +0200 Subject: [PATCH] scripts: fix pushing tagged images by using github ref and push mutable 'master' tag --- scripts/push-docker-image.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/push-docker-image.sh b/scripts/push-docker-image.sh index 7059449f6..4810aaf0f 100755 --- a/scripts/push-docker-image.sh +++ b/scripts/push-docker-image.sh @@ -8,16 +8,24 @@ set -u CPU_ARCHS="amd64 arm64 arm" +# Use branch name as dev image tags +export TAG="${GITHUB_REF#refs/heads/}" + # Push `-dev` images unless commit is tagged export REPO="${REPO:-"quay.io/prometheus-operator/prometheus-operator-dev"}" export REPO_PROMETHEUS_CONFIG_RELOADER="${REPO_PROMETHEUS_CONFIG_RELOADER:-"quay.io/prometheus-operator/prometheus-config-reloader-dev"}" -if git describe --exact-match; then + +# If TAG is not a branch name, push tagged release +if [[ ! "${TAG}" =~ ^refs ]]; then + export TAG="${GITHUB_REF#refs/tags/}" + export REPO="quay.io/prometheus-operator/prometheus-operator" + export REPO_PROMETHEUS_CONFIG_RELOADER="quay.io/prometheus-operator/prometheus-config-reloader" +fi + +# Push mutable `master` tag to main repositories +if [ "${TAG}" == "master" ]; then export REPO="quay.io/prometheus-operator/prometheus-operator" export REPO_PROMETHEUS_CONFIG_RELOADER="quay.io/prometheus-operator/prometheus-config-reloader" - export TAG="${GITHUB_REF#refs/tags/}" -else - # Use branch name as dev image tags - TAG="${GITHUB_REF#refs/heads/}" fi for arch in ${CPU_ARCHS}; do