1
...


pipeline.aws(configMap) {

properties([
        parameters([
                extendedChoice(name: 'built_version', type: 'PT_SINGLE_SELECT', description: 'qa built version to deploy', visibleItemCount: 10, groovyScript:
                        '''def job = jenkins.model.Jenkins.instance.getItemByFullName('my-demo-app-build-deploy-qa/master')
                           return job.builds.findResults { it.result == hudson.model.Result.SUCCESS ? it.getNumber().toInteger() : null }''')
        ])
])


    node('myimage') {
            stage('Checkout') {
                ...
            }
            stage(...){
                ...
            }
            stage(...) {
                ...
            }
    }
}

I am using the "Extended Choice Parameter Plug-In" to fetch the successful build number from the job 'my-demo-app-build-deploy-qa/master' to this job to promote it to the next environment. However, the Build with Parameters button keeps reverting back to Build Now causing an unnecessary failed build.

Once the job is triggered with Build Now, the button changes to Build with Parameters and everything works fine for a few hours.

Saif
  • 2,530
  • 3
  • 27
  • 45
  • 1
    Since your parameters ared declared in your pipeline, Jenkins can't know them at the beginning until your run it just once. The first build fail because parameters are missing in some steps. Then, the `Build with Parameters` is available and you can run it successfully. – fmdaboville Sep 09 '21 at 07:07
  • It's ok if I have to do it just for the first build. But the options keeps disappearing every few hours. – Saif Sep 09 '21 at 07:09
  • What type of pipeline are you using ? Did the pipeline change during this time ? – fmdaboville Sep 09 '21 at 07:38
  • @fmdaboville Found out that it was a problem with a seeder job that was refreshing this job from being parameterized to non-parameterized. Thanks. – Saif Sep 11 '21 at 07:55
  • @Saif what was the issue with the seeder job? – drcomputer Dec 01 '22 at 18:11
  • 1
    @drcomputer The seeder job was setting the default properties. So the properties from the job's Jenkinsfile was getting overridden. – Saif Dec 01 '22 at 18:12
  • 1
    Gotcha - good to know the order of prioritization there! Thanks for your reply on this year-old thread. – drcomputer Dec 02 '22 at 21:18

0 Answers0