From 550f4642634ccc8bfd5f07c63be87a1160e4d02c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 21 Oct 2024 15:58:34 +0200 Subject: [PATCH] chore(ci): build docker images for staging branch --- .github/workflows/docker-image.yml | 1 + bin/get-docker-tags.sh | 8 ++++---- bin/push-docker-tags.sh | 10 ++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f5642fe6dd5..ce927e5e5ce 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,6 +19,7 @@ on: push: branches: - 'master' + - 'staging' - 'bifrost-*' tags: - 'v*' diff --git a/bin/get-docker-tags.sh b/bin/get-docker-tags.sh index e54da6482f7..1c4e184f222 100755 --- a/bin/get-docker-tags.sh +++ b/bin/get-docker-tags.sh @@ -18,7 +18,7 @@ set -euo pipefail if [[ $# -lt 1 ]] ; then echo 'At least 1 arg required.' echo 'Usage:' - echo './push-docker-tags.sh [git commit sha1] [git branch name] [git tag name]' + echo './get-docker-tags.sh [git commit sha1] [git branch name] [git tag name]' exit 1 fi @@ -50,9 +50,9 @@ elif [[ $GIT_BRANCH =~ ^bifrost-.* ]]; then branch=$(echo "$GIT_BRANCH" | tr '/' '-' | tr --delete --complement '[:alnum:]-') echoImageName "${branch}-${BUILD_NUM}-${GIT_SHA1_SHORT}" -elif [ "$GIT_BRANCH" = "master" ]; then - echoImageName "master-${BUILD_NUM}-${GIT_SHA1_SHORT}" - echoImageName "master-latest" +elif [ "$GIT_BRANCH" = "master" ] || [ "$GIT_BRANCH" = "staging" ]; then + echoImageName "${GIT_BRANCH}-${BUILD_NUM}-${GIT_SHA1_SHORT}" + echoImageName "${GIT_BRANCH}-latest" else echo "Nothing to do. No docker tag defined for branch: $GIT_BRANCH, tag: $GIT_TAG" diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index af809b989e5..a33948307ee 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash - +# +# TODO: this script is legacy, use get-docker-tags.sh instead. +# # push-docker-tags.sh # # Run from ci to tag images based on the current branch or tag name. @@ -68,9 +70,9 @@ elif [[ $GIT_BRANCH =~ ^bifrost-.* ]]; then branch=$(echo "$GIT_BRANCH" | tr '/' '-' | tr --delete --complement '[:alnum:]-') pushTag "${branch}-${BUILD_NUM}-${GIT_SHA1_SHORT}" -elif [ "$GIT_BRANCH" = "master" ]; then - pushTag "master-${BUILD_NUM}-${GIT_SHA1_SHORT}" - pushTag "master-latest" +elif [ "$GIT_BRANCH" = "master" ] || [ "$GIT_BRANCH" = "staging" ]; then + pushTag "${GIT_BRANCH}-${BUILD_NUM}-${GIT_SHA1_SHORT}" + pushTag "${GIT_BRANCH}-latest" else echo "Nothing to do. No docker tag defined for branch: $GIT_BRANCH, tag: $GIT_TAG"