Hello,
I'm wondering why bitbucket pipelines are parsing stings inside the script section.
image: ubuntu:18.04
pipelines:
default:
- step:
script:
- echo "Echo from pipelines : ${MY_VAR}"
This is not valid because of the ":" !!
Hi Hamdi,
The colon character is causing the particular line you have to be parsed as a map instead of a string. This is part of the YAML specification, which the bitbucket-pipelines.yml file follows. Specifically, a colon followed by a space will make the entire line interpreted as a map instead of a string.
There are a few ways to work around this, which will all make the line be interpreted as a string instead.
1. Remove the space after the colon
image: ubuntu:18.04
pipelines:
default:
- step:
script:
- echo "Echo from pipelines :${MY_VAR}"
2. Escape the space after the colon
image: ubuntu:18.04
pipelines:
default:
- step:
script:
- echo "Echo from pipelines :\ ${MY_VAR}"
3. Quote the entire command line, which will indicate the line is a string.
image: ubuntu:18.04
pipelines:
default:
- step:
script:
- 'echo "Echo from pipelines : ${MY_VAR}"'
4. Quote the colon character
image: ubuntu:18.04
pipelines:
default:
- step:
script:
- echo "Echo from pipelines ':' ${MY_VAR}"
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The php-codeception uses an option string like a YAML-syntax:
./vendor/bin/codecept run --override="paths: output: ./test-reports"
Colons and unquoted spaces are mandatory.
The only way I have found is:
pipelines:
default:
- step:
script:
- printf './vendor/bin/codecept run --override="paths\x3a output\x3a ./test-reports"' | sh -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.