Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47559

NullPointerException in Declarative Jenkinsfile Pipeline Syntax Validator (when clause)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Jenkinsfiles like what you see below (note the lack of 'expression' block in the 'when' clause) cause a NullPointerException instead of reporting a syntax error.

      pipeline {
        agent { label 'Some Machine' }
        
        parameters {
          string(name: 'Type', defaultValue: 'Nightly', description: 'Type of build to perform -- can be "Nightly," "CI," or "PR"')
        }
      
        stages {
      
          stage('Fix Me') {
            when {
              params.Type == 'CI'
            }
      
            steps {
              echo "Hello World"
            }
          }
        }
      }
      

        Attachments

          Issue Links

            Activity

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/209
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
            pipeline-model-definition/src/test/resources/errors/whenContainingNonCondition.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/114588a7be038d48177c80d9f05e0a7e017c9501
            Log:
            [FIXED JENKINS-47559] Don't do full validation for non-conditions

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/resources/errors/whenContainingNonCondition.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/114588a7be038d48177c80d9f05e0a7e017c9501 Log: [FIXED JENKINS-47559] Don't do full validation for non-conditions

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                nroth Nicholas Roth
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: