/bin/sh: syntax error: unexpected ";"

We keep getting this failure message on various freestyle steps. Usually when there are several multiline commands.
Seems like something is off with either the yaml parser or the CF execution.

  commands:
    - set -x
    - |
      if [[ "${MONITORING_ONLY}" = "true" ]]; then
        cf_export SINGLE_CLUSTER="primary"
        exit 0
      fi
      if [[ -z "${SERVICE_NAMESPACE// }" ]]; then
        cf_export MIGRATE_EXISTING="true"
      else
        cf_export MIGRATE_EXISTING="false"
        exit 0
      fi
    - echo "hello world"
    - apk add --update jq pcre-tools && rm -rf /var/cache/apk/*
    - ./script.sh

Hello.

What is the URL of the build that has the issue?

Just missing a -:

  commands:
    - set -x
    - |-
      if [[ "${MONITORING_ONLY}" = "true" ]]; then
        cf_export SINGLE_CLUSTER="primary"
        exit 0
      fi
      if [[ -z "${SERVICE_NAMESPACE// }" ]]; then
        cf_export MIGRATE_EXISTING="true"
      else
        cf_export MIGRATE_EXISTING="false"
        exit 0
      fi
    - echo "hello world"
    - apk add --update jq pcre-tools && rm -rf /var/cache/apk/*
    - ./script.sh

Well Well Well !! It just took 3 years to be fixed! :stuck_out_tongue:

@Kostis
Is there a solution to this problem. I tried the above suggestion but it didn’t work.

version: '1.0'

steps:
  my_step:
    title: My Step
    image: my-image
    commands:
      - var='value' # from an expression 
//some other 10 commands 
      - |
        if [ "$var" = "true" ]; then
          echo "success"
        else
          echo "fail"
          exit 1
        fi

/bin/sh: syntax error: unexpected “;”

It is hard to debug this here.

Please open a support ticket and be sure to include the URL of the build that has the issue.

Thank you