Below my .gitlab-ci.yml
file:
image: docker:latest
services:
- docker:dind
stages:
- deploy_dev_env
Deploy DEV Environment:
stage: deploy_dev_env
script:
- curl -v -H "Content-Type: multipart/form-data" -X PUT -F uploadInput=@schema/schema.xml -F overwrite=true -F xmlaEnabledFlag=true -F parameters="DataSource=outputDS" -F parameters="EnableXmla=true" -u $PENTAHO_DEPLOY_USER:$PENTAHO_DEPLOY_PASSWORD http://$PENTAHO_HOST/pentaho/plugin/data-access/api/datasource/analysis/catalog/sca
This very simple script is causing an error because the colons(:) in the "Content-Type: multipart/form-data"
piece.
Running the CI Lint in the script I get the following:
Status: syntax is incorrect
jobs:deploy dev environment:script config should be a string or an array containing strings and arrays of strings
If I replace "Content-Type: multipart/form-data"
by "Content-Type multipart/form-data"
(removed the ":"), I get I correct syntax for my .gitlab-ci.yml file.
Is this a bug or should I re-write my curl command in a different way ?
Docs warn about special characters in yaml script:
Note: Sometimes, script commands will need to be wrapped in single or double quotes. For example, commands that contain a colon (:) need to be wrapped in quotes so that the YAML parser knows to interpret the whole thing as a string rather than a “key: value” pair. Be careful when using special characters: :, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `.
One of the option would be to use yaml block scalar
Deploy DEV Environment:
stage: deploy_dev_env
script: >
curl -v -H "Content-Type: multipart/form-data" -X PUT -F uploadInput=@schema/schema.xml -F overwrite=true -F xmlaEnabledFlag=true -F parameters="DataSource=outputDS" -F parameters="EnableXmla=true" -u $PENTAHO_DEPLOY_USER:$PENTAHO_DEPLOY_PASSWORD http://$PENTAHO_HOST/pentaho/plugin/data-access/api/datasource/analysis/catalog/sca
or use some other way to escape colon in yaml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With