diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-01-22 11:30:49 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-01-22 11:30:49 +0300 |
commit | 60d3fe5804ccb17f0069b51464f5aa3dcc5f63d5 (patch) | |
tree | b89b9ab12e248e1599f4ecab70da9d808327f7a8 /lib | |
parent | 91d7e387288f55709722a6ad9eca0c053df74d00 (diff) | |
parent | 338f4b699494baca5b30c8c644db4cadf2afa99f (diff) |
Merge branch 'force-redeploy-on-updated-secrets' into 'master'
Force Auto DevOps redeployment when application secrets are updated
Closes #55540
See merge request gitlab-org/gitlab-ce!24498
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index 95160e1432f..9362596eb60 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -611,16 +611,16 @@ rollout 100%: track="${1-stable}" export APPLICATION_SECRET_NAME=$(application_secret_name "$track") - bash -c ' - function k8s_prefixed_variables() { - env | sed -n "s/^K8S_SECRET_\(.*\)$/\1/p" - } - - kubectl create secret \ - -n "$KUBE_NAMESPACE" generic "$APPLICATION_SECRET_NAME" \ - --from-env-file <(k8s_prefixed_variables) -o yaml --dry-run | - kubectl replace -n "$KUBE_NAMESPACE" --force -f - - ' + env | sed -n "s/^K8S_SECRET_\(.*\)$/\1/p" > k8s_prefixed_variables + + kubectl create secret \ + -n "$KUBE_NAMESPACE" generic "$APPLICATION_SECRET_NAME" \ + --from-env-file k8s_prefixed_variables -o yaml --dry-run | + kubectl replace -n "$KUBE_NAMESPACE" --force -f - + + export APPLICATION_SECRET_CHECKSUM=$(cat k8s_prefixed_variables | sha256sum | cut -d ' ' -f 1) + + rm k8s_prefixed_variables } function deploy_name() { @@ -688,6 +688,7 @@ rollout 100%: --set application.track="$track" \ --set application.database_url="$DATABASE_URL" \ --set application.secretName="$APPLICATION_SECRET_NAME" \ + --set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \ --set service.url="$CI_ENVIRONMENT_URL" \ --set service.additionalHosts="$additional_hosts" \ --set replicaCount="$replicas" \ @@ -722,6 +723,7 @@ rollout 100%: --set application.track="$track" \ --set application.database_url="$DATABASE_URL" \ --set application.secretName="$APPLICATION_SECRET_NAME" \ + --set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \ --set service.url="$CI_ENVIRONMENT_URL" \ --set service.additionalHosts="$additional_hosts" \ --set replicaCount="$replicas" \ |