title: Azure pipeline with custom variables as condition
body: <p>We would like to optimize our pipelines to avoid running steps that are not needed for the particular case. <br>I have created the variable <code>shouldTriggerAnyBuild</code> but it always seems to be true (or ignored), as the specified steps always runs, even though the none of the steps later, where the conditions are combined from, are run.</p>
  <p>What is the problem with the script, or how can I debug it?</p>
  <pre><code>trigger:
  - master
  - stage
  - release/*
  
  pool:
    vmImage: 'macOS-latest'
  
  variables:
    shouldTriggerAnyBuild: $[ or(and(eq(variables['Build.SourceBranch'], 'refs/heads/master'), not(startsWith(variables['Build.SourceVersionMessage'], 'release:'))), eq(variables['Build.SourceBranch'], 'refs/heads/stage'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')) ]
    
  steps:
  - task: UseRubyVersion@0
    inputs:
      versionSpec: '~&gt; 2.6'
  
  - script: echo &quot;y&quot; | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-29;google_apis;x86'
    displayName: 'install/setup android sdkmanager'
    condition: variables.shouldTriggerAnyBuild
  
  - script: gem install bundler
    displayName: 'gem install bundler'
    condition: variables.shouldTriggerAnyBuild
  
  - script: bundle install
    displayName: 'bundle install'
    condition: variables.shouldTriggerAnyBuild
  
  - script: bundle exec fastlane ciBuildDev
    displayName: 'build dev'
    condition: and(eq(variables['Build.SourceBranch'], 'refs/heads/master'),  not(startsWith(variables['Build.SourceVersionMessage'], 'release:')))
  
  - script: bundle exec fastlane ciDeployToTest
    displayName: 'build stage'
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/stage')
  
  - script: bundle exec fastlane ciDeployToGooglePlay
    displayName: 'build release'
    condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')
      
  - task: PublishBuildArtifacts@1
    displayName: &quot;Publish artifacts .apk&quot;
    condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')
    inputs:
      PathtoPublish: ./app/build/outputs/apk/prod/app-prod-unsigned.apk
      ArtifactName: Prod_app_apk
          
  </code></pre>
  <p><a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops</a></p>