title: Google Cloud build conditional step
body: <p>I have the following <code>cloudbuild.yaml</code> file:</p>
  <pre class="lang-yaml prettyprint-override"><code>substitutions:
      _CLOUDSDK_COMPUTE_ZONE: us-central1-a 
      _CLOUDSDK_CONTAINER_CLUSTER: $_CLOUDSDK_CONTAINER_CLUSTER
  steps:
  - name: gcr.io/$PROJECT_ID/sonar-scanner:latest
    args:
      - '-Dsonar.host.url=https://sonar.test.io'
      - '-Dsonar.login=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
      - '-Dsonar.projectKey=test-service'
      - '-Dsonar.sources=.'
  - id: 'build test-service image'
    name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA', '.']
  - id: 'push test-service image'
    name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA']
  - id: 'set test-service image in yamls'
    name: 'ubuntu'
    args: ['bash','-c','sed -i &quot;s,TEST_SERVICE,gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA,&quot; k8s/*.yaml']
  - id: kubectl-apply
    name: 'gcr.io/cloud-builders/kubectl'
    args: ['apply', '-f', 'k8s/']
    env:
    - 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
    - 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
  images: ['gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA']
  </code></pre>
  <p>I would like to make the <code>sonar-scanner</code> step conditional (if we are on the production branch, I want to skip the sonar step; other branches should run that step). I would also like to use the same <code>cloudbuild.yaml</code> across all branches.</p>
  <p>Is it possible to do this?</p>