Open wickedest opened 1 day ago
hey, i don't think this is a bug on our side but rather quirks with shell
try surrounding your variables with double quotes
@ANGkeith, thanks for your quick reply. I tried what you suggest and got it to work, but it only works with .env
. The yaml config behaves differently and only ever produces one line.
This is exactly what I am using:
Your explanation is clear. I don't know what wizardry gitlab is using, but unfortunately it requires that I change my CI to work-around this difference in behaviour, which is unfortunate.
Incidentally, I came across another separate, but related issue. I'll raise a separate ticket.
I can confirm the quotes trick works with file .env
config as well:
VAL1='~/.ssh/known_hosts'
Minimal .gitlab-ci.yml illustrating the issue
Expected behavior It should echo multiline values preserving the
\n
character.Actual behavior
Host information Ubuntu gitlab-ci-local 4.1.33
Containerd binary No
Additional context I am trying to replicate the gitlab environment variables locally and I am struggling. In gitlab, my script creates
.ssh/config
by echoing the value of the file, which is stored in gitlab variables. The script basically just does echo:However, no matter what multiline format I use, the line endings are striped and the multilines are converted to a single string. Either I am doing this wrong, or this is a bug.
PS.
gitlab-ci-local
is awesome - tyvm! I'm eager to get it working.