TIL: Gitlab YML Hates Me
If you have a :
in a script line in your Gitlab pipeline config, it will go
nuts and make you sad.
Example
whatever:
variables:
BLAH: "sweet"
script:
- echo "Hello!"
- echo "BLAH: ${BLAH}"
That will give you an error like
script config should be a string or a nested array of strings up to 10 levels deep
Instead
whatever:
variables:
BLAH: "sweet"
script:
- echo "Hello!"
- echo 'BLAH: ${BLAH}'
That should fix it, right?!
No. Same error.
Let’s see if the Gitlab docs have any insights.
Be careful when using these characters as well: {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `.
“Be careful” doesn’t explain much.
Instead Instead
whatever:
variables:
BLAH: "sweet"
script:
- echo "Hello!"
- echo "BLAH ${BLAH}"