Issue
After Jenkins update to 2.249, trying to set a default value for the "password" parameter using DSL job shows the following error:
No such property: Secret for class: javaposse.jobdsl.plugin.structs.DescribableContext
Explanation
After Jenkins update to 2.249, the "password" parameter method to set the default value changed from defaultValue("foo")
to defaultValueAsSecret(Secret.fromString("foo"))
(as described in https://issues.jenkins.io/browse/JENKINS-63499) and Job DSL plugin doesn’t recognize the hudson.util.Secret
class.
Example of the new method:
password{ name('name') description('description') defaultValueAsSecret(Secret.fromString("foo")) }
Resolution
This is being fixed in https://issues.jenkins.io/browse/JENKINS-64539. Consult if there is a fix in more recent versions. On the contrary, it won’t be possible to set a default value for a password using Jod DSL.
As a workaround, create a scripted pipeline for this purpose and avoid Job DSL for the moment.