when condition not correctly discovering branch

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

XMLWordPrintable

      I created a new pipeline job and defined "Pipeline script from SCM" using Git:

      • repo Url: git@bitbucket.org:yooture/xxx.git
      • branch specifier: */master
      • Repository browser: (auto)
      • Additional Behaviours: none
      • Script Path: Jenkinsfile
      • Lightweight checkout: on

      In have the following simple pipeline:

       

      pipeline {
        agent { label 'lxc-fedora25' }
      
        tools {
          maven 'MVN_352'
          jdk "Oracle JDK 1.8 (latest)"
        }
      
        stages { 
          stage('build Snapshot') {
            when { not { branch 'master' } }      
            steps {
               sh 'mvn clean install -Dmaven.test.failure.ignore'
            }
          }
          stage('Build Release') {
            when { branch 'master' }
            steps {    
                sh "mvn clean deploy"
            }
          }      
        }
      }

       

      even though the branch specifier is specified as "*/master", "build Snapshot" stage is always executed

       

       

            Assignee:
            Andrew Bayer
            Reporter:
            Dominik Bartholdi
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: