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

first build fails because of missing parameter

      The first automatic job execution of a job created by a "multibranch project" will be triggered without parameters. e.g. the following pipeline will print "null" instead of the default value of MY_PARAM. Subsequent executions will work correctly. This is very unfortunate, as such jobs are typically created for short lived branches, in the most ideal case, no further commits are even made to them - they get merged and vanish again.

      pipeline {
      
        parameters {
          choiceParam(choices: 'AA\nBB', description: 'please select...', name: 'MY_PARAM')
        }  
      
        agent any
        stages {
      
          stage ('test') {
            steps {
                sh "echo ${env.MY_PARAM}"
            }
          }
        }
      }
      

          [JENKINS-40631] first build fails because of missing parameter

          Dominik Bartholdi created issue -
          Dominik Bartholdi made changes -
          Description Original: when


          The first automatic job execution of a job created by a "multibranch project" will be triggered without parameters. e.g. the following pipeline will print "null" instead of the default value of MY_PARAM. Subsequent executions will work correctly. This is very unfortunate, as such jobs are typically created for short lived branches, in the most ideal case, no further commits are even made to them - they get merged and vanish again.

          {noformat}
          pipeline {

            parameters {
              choiceParam(choices: 'AA\nBB', description: 'please select...', name: 'MY_PARAM')
            }

            agent any
            stages {

              stage ('test') {
                steps {
                    sh "echo ${env.MY_PARAM}"
                }
              }
            }
          }
          {noformat}
          New: The first automatic job execution of a job created by a "multibranch project" will be triggered without parameters. e.g. the following pipeline will print "null" instead of the default value of MY_PARAM. Subsequent executions will work correctly. This is very unfortunate, as such jobs are typically created for short lived branches, in the most ideal case, no further commits are even made to them - they get merged and vanish again.

          {noformat}
          pipeline {

            parameters {
              choiceParam(choices: 'AA\nBB', description: 'please select...', name: 'MY_PARAM')
            }

            agent any
            stages {

              stage ('test') {
                steps {
                    sh "echo ${env.MY_PARAM}"
                }
              }
            }
          }
          {noformat}
          Andrew Bayer made changes -
          Link New: This issue relates to JENKINS-40241 [ JENKINS-40241 ]
          Dominik Bartholdi made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Liam Newman made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: