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

NullPointerException in Declarative Jenkinsfile Pipeline Syntax Validator (when clause)

      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"
            }
          }
        }
      }
      

          [JENKINS-47559] NullPointerException in Declarative Jenkinsfile Pipeline Syntax Validator (when clause)

          Nicholas Roth created issue -
          Andrew Bayer made changes -
          Component/s New: pipeline-model-definition-plugin [ 21706 ]
          Component/s Original: declarative-pipeline-when-conditions-plugin [ 23168 ]
          Component/s Original: pipeline [ 21692 ]
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Andrew Bayer added a comment -

          Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/209
          Andrew Bayer made changes -
          Remote Link New: This issue links to "PR #209 (Web Link)" [ 17926 ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          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

          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
          Andrew Bayer made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.
          Liam Newman made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            abayer Andrew Bayer
            nroth Nicholas Roth
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: