From a1e8579537ef605a007dd753b62f3dc0476c8ee9 Mon Sep 17 00:00:00 2001 From: Micah Nagel <micah.nagel@parsons.com> Date: Thu, 15 Jul 2021 17:38:17 +0000 Subject: [PATCH] Updated deploy script to handle secrets properly --- scripts/deploy/01_deploy_bigbang.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/deploy/01_deploy_bigbang.sh b/scripts/deploy/01_deploy_bigbang.sh index aa124ba052..42cd80b23b 100755 --- a/scripts/deploy/01_deploy_bigbang.sh +++ b/scripts/deploy/01_deploy_bigbang.sh @@ -37,19 +37,27 @@ helm upgrade -i bigbang chart -n bigbang --create-namespace \ # otherwise use *.bigbang.dev if [ "$(yq e ".addons.keycloak.enabled" "tests/ci/k3d/values.yaml")" == "true" ]; then # apply secrets kustomization pointing to current branch - echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} branch" - if [ -z "$CI_COMMIT_TAG" ]; then + if [[ $(git branch --show-current) == "${CI_DEFAULT_BRANCH}" ]]; then + echo "Deploying secrets from the ${CI_DEFAULT_BRANCH} branch" + kubectl apply -f tests/ci/keycloak.yaml + elif [ -z "$CI_COMMIT_TAG" ]; then + echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} branch" cat tests/ci/keycloak.yaml | sed 's|master|'"$CI_COMMIT_REF_NAME"'|g' | kubectl apply -f - else + echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} tag" # NOTE: $CI_COMMIT_REF_NAME = $CI_COMMIT_TAG when running on a tagged build cat tests/ci/keycloak.yaml | sed 's|branch: master|tag: '"$CI_COMMIT_REF_NAME"'|g' | kubectl apply -f - fi else - # apply secrets kustomization pointing to current branch - echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} branch" - if [ -z "$CI_COMMIT_TAG" ]; then + # apply secrets kustomization pointing to current branch or master if an upgrade job + if [[ $(git branch --show-current) == "${CI_DEFAULT_BRANCH}" ]]; then + echo "Deploying secrets from the ${CI_DEFAULT_BRANCH} branch" + kubectl apply -f tests/ci/shared-secrets.yaml + elif [ -z "$CI_COMMIT_TAG" ]; then + echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} branch" cat tests/ci/shared-secrets.yaml | sed 's|master|'"$CI_COMMIT_REF_NAME"'|g' | kubectl apply -f - else + echo "Deploying secrets from the ${CI_COMMIT_REF_NAME} tag" # NOTE: $CI_COMMIT_REF_NAME = $CI_COMMIT_TAG when running on a tagged build cat tests/ci/shared-secrets.yaml | sed 's|branch: master|tag: '"$CI_COMMIT_REF_NAME"'|g' | kubectl apply -f - fi -- GitLab