summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-12-15 00:41:51 +1300
committerThong Kuah <tkuah@gitlab.com>2018-12-18 18:04:54 +1300
commitdd3668adefa1b65e0fb58df33350b5ed144f5c44 (patch)
tree7e8ac71500a382fb0778fbab0e1ff6b7d3315a9b
parentef2407475414d9d96d174777b83053a75a05630f (diff)
downloadgitlab-ce-dd3668adefa1b65e0fb58df33350b5ed144f5c44.tar.gz
Minor edits based on BE feedback
-rw-r--r--lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
index ad1c6f2bf92..1b55a6b12cd 100644
--- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
@@ -595,12 +595,13 @@ rollout 100%:
fi
}
- # "Returns" any prefixed variables with
- # the global variable $K8S_VARIABLES
- function get_prefixed_variables() {
- prefix="K8S_SECRET"
+ # Finds any variables prefixed with `K8S_SECRET_`, and exports them as the
+ # global $K8S_VARIABLES with prefix removed.
+ function extract_prefixed_variables() {
+ prefix="K8S_SECRET_"
+ k8s_variables=$(env | (grep "^${prefix}" || [[ $? == 1 ]]) | sed "s/^${prefix}//")
- export K8S_VARIABLES=$(env | (grep "^${prefix}_" || [[ $? == 1 ]]) | sed "s/^${prefix}_//")
+ export K8S_VARIABLES=$k8s_variables
}
function deploy() {
@@ -628,14 +629,14 @@ rollout 100%:
secret_name=''
fi
- get_prefixed_variables
+ extract_prefixed_variables
if [[ -n "$K8S_VARIABLES" ]]; then
echo "Prefixed CI variables found, creating secret..."
application_secret_name="${name}-secret"
-
fromLiteralArgs=""
- for var in ${K8S_VARIABLES}; do
- fromLiteralArgs="${fromLiteralArgs:+${fromLiteralArgs} }--from-literal=${var}"
+
+ for k8s_variable in ${K8S_VARIABLES}; do
+ fromLiteralArgs="${fromLiteralArgs:+${fromLiteralArgs} }--from-literal=${k8s_variable}"
done
# We want fromLiteralArgs to be interpreted as args, so don't quote it!