yaml invalid when trying to load somthing via curl and custom header
Summary
Let's say we want to download an artifact via curl, because we do not have cross project dependencies. In this case we can do somsing like this:
curl -i -f -L -H "PRIVATE-TOKEN: ${PRIVATE_TOKEN}" -o swagger.json 'https://example.com/namespace/project/-/jobs/artifacts/develop/raw/swagger.json?job=doc'
Steps to reproduce
The .gitlab-ci.yml looks like:
pages:
stage: deploy
script:
- mkdir public
- curl -i -f -L -H "PRIVATE-TOKEN: ${PRIVATE_TOKEN}" -o swagger.json 'https://example.com/namespace/project/-/jobs/artifacts/develop/raw/swagger.json?job=doc'
- cp swagger.json public/
artifacts:
paths:
- public
only:
- develop
but in this case, we will get an invalid yaml error:
Status: syntax is incorrect
Error: jobs:pages:script config should be a string or an array of strings
If we remove the : from the curl header definition, the yaml parser gets happy, but the http header isn't valid any more.
Possible fixes
As workaround we can add a script that executs curl, but it isn't a nice solution.
Edited by Marcello