...
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.