Pipelines step > script syntax error

Issue #18836 resolved
Cory Robinson created an issue

This will error in the pipelines with:

There is an error in your bitbucket-pipelines.yml at [pipelines > tags > v*.*.*-*.* > 1 > step > script > 1]. To be precise: Missing or empty command string. Each item in this list should either be a single command string or a map defining a pipe invocation.
'v*.*.*-*.*':
  - step: *build
  - step:
      name: Version Tag
      script:
        - echo "package version: $BITBUCKET_TAG"

This will not error and runs successfully (notice the removed “:” after “version”):

'v*.*.*-*.*':
  - step: *build
  - step:
      name: Version Tag
      script:
        - echo "package version $BITBUCKET_TAG"

Comments (1)

  1. aneita staff

    Hey Cory,

    Thanks for reaching out. While - echo "package version: $BITBUCKET_TAG" is valid YAML, a colon followed by a space will make the line be interpreted as a map instead of a string. To Bitbucket Pipelines, this is invalid as we expect a string for each command in the script.

    To workaround this, you can put the entire line in quotation e.g. "echo package version: $BITBUCKET_TAG". Hope this helps!

  2. Log in to comment