when {branch} stage conditional regression

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The when branch conditional seems to still be broken. Similar to JENKINS-41012. In this case we are using GitHub with webhooks to trigger a build.  Following the good test code in 41012 I tested with the following. 

      Results - I get echo expression and echo env, but branch is always skipped. 

      Test pipeline code stage is:

      stages {
      stage('test condition: expression') {
      when {
      expression {
      return env.GIT_BRANCH == "origin/master"
      }
      }
      steps {
      sh 'echo "expression"'
      }
      }
      
      stage('test when: env') {
      when {
      environment name: "GIT_BRANCH", value: "origin/master"
      }
      steps {
      sh 'echo "env"'
      }
      }
      
      stage('test when: branch') {
      when {
      branch "origin/master"
      }
      steps {
      sh 'echo "branch"'
      }
      }
      }
      

            Assignee:
            Andrew Bayer
            Reporter:
            Eric Nelson
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: