Details

    • Similar Issues:

      Description

      This pipeline fails with a NullPointerException:

      config = [:]
      
      pipeline {
          agent any
          stages {
              stage ('prepare') {
                  when {
                      branch config.branch
                  }
                  steps {
                      echo "hello branch"            
                  }
              }
          }
      }
      

      I know, the pipeline might look a bit strange with having a config/map defined - but in our real pipeline, we have some logic to select the correct config/map object before the pipeline starts. This allows us to reuse a lot more...

      exception:

      java.lang.NullPointerException
      	at org.jenkinsci.plugins.pipeline.modeldefinition.when.impl.BranchConditional.branchMatches(BranchConditional.java:64)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.when.impl.BranchConditional$branchMatches.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                imod Dominik Bartholdi
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: