Skip to content
Snippets Groups Projects
Commit bc2f8d58 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: support multi-lines environment variables substitution

parent f5d041f4
Branches
Tags
No related merge requests found
......@@ -292,7 +292,21 @@ In order to be able to implement some **genericity** in your scripts and templat
* any [GitLab CI variable](https://docs.gitlab.com/ee/ci/variables/#predefined-environment-variables)
(ex: `${CI_ENVIRONMENT_URL}` to retrieve the actual environment exposed route)
> :warning: In order to be properly replaced, variables in your YAML descriptors shall be written with curly braces (ex: `${MYVAR}` and not `$MYVAR`).
> :warning:
>
> In order to be properly replaced, variables in your YAML descriptors shall be written with curly braces (ex: `${MYVAR}` and not `$MYVAR`).
>
> Multiline variables must be surrounded by **double quotes** (`"`). Example:
>
> ```yaml
> [...]
> containers:
> - name: restaurant-app
> env:
> # multiline variable
> - name: MENU
> value: "${APP_MENU}"
> ```
## kube-score job
......
......@@ -236,7 +236,7 @@ stages:
}
function awkenvsubst() {
awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1'
awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);val=ENVIRON[var];gsub(/["\\]/,"\\\\&", val);gsub("\n", "\\n", val);gsub("\r", "\\r", val);gsub("[$]{"var"}",val)}}1'
}
function login() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment