How to create configuration files that contain colons in YAML?
It should work if you wrap the whole line within quotes like this:
- 'echo "foo: $VAR" > site.yml'
Gitlab's CI lint marks it as correct syntax.
See here for more info.
Single quotes around the whole line, as depicted by @Jawad, works:
- 'echo "foo: $VAR" > site.yml'
But if your command contains other single quotes, I find it easiest to use the pipe
Block Scaler Style: |
- |
echo "I want to echo the key"
echo 'foo: $VAR' > site.yml
More documentation on Block Scaler Styles can be found here: http://www.yaml.org/spec/1.2/spec.html#id2760844