Closed ro-kr closed 3 years ago
Can someone please have a a look at it and merge? This feature would be a fine addition to the plugin.
thanks for merging this. when will it be available for automatic upgrade from Jenkins ? our devops say Jenkins doesn't give them the option to upgrade from 1.2 and the github release is not in .hpi format. I created an issue #13 for the same.
I am trying to add this in a seed job but I am getting this error:
Processing DSL script nonprod_deploy.jenkins
ERROR: (nonprod_deploy.jenkins, line 30) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.persistentBoolean() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:Boolean, defaultValue:true, description:A boolean parameter, ...]]
Finished: FAILURE
Any idea what I am doing wrong?
This is my code:
...
parameters {
persistentBoolean(name: 'Boolean', defaultValue: true, description: 'A boolean parameter', successfulOnly: false)
}
...
However this works no problem: https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.booleanParam
I guess this is a limitation of the Jenkins Job DSL plugin, it only supports the parameter types listed here: https://jenkinsci.github.io/job-dsl-plugin/#path/job-parameters
This adds support for declarative pipeline scripts, so that the persistent parameters can be created like the following (like requested in #8)
The parameters are also supported by the declarative snippet generator.
For this feature it's needed to bump the minimal required Jenkins version to 2.164.1. The additional code is basically copied from the build-in non-persistent variants of these parameter types.
Further visible improvements (as they exist on the non-persistent parameter types):
Code improvements:
getDefaultParameterValue()
in order to separate it from the original default value used for editing the parameter definition.resolves #8, fixes #9, fixes #4