Reputation: 49
I need jobdsl syntax for getting the password parameter in code. I have tried few syntax everything getting failed
eg: password {
name('TEST_ADMIN_USERNAME')
defaultValueAsSecret('foo')
description('User name with the admin privilege')
trim(false)
}
Upvotes: 3
Views: 1348
Reputation: 5001
Job DSL:
Within a job DSL, you can use nonStoredPasswordParam, to provide a password. The nonStoredPasswordParam
parameter is provided by the Mask Passwords plugin, hence need to install the plugin as well. The parameter declaration would look something like the below:
parameters {
nonStoredPasswordParam('TEST_ADMIN_USERNAME', 'User name with the admin privilege')
}
Declarative Pipeline:
In a declarative pipeline defined within a pipeline {}
block, using the password
parameter specifying the names of the method arguments explicitly works. Something like below:
parameters {
password(
name: 'TEST_ADMIN_USERNAME',
description: 'User name with the admin privilege'
)
}
Upvotes: 2
Reputation: 205
I am still searching for it from a long time, only find one ticket from 1 year back and still no solution " https://github.com/jenkinsci/job-dsl-plugin/pull/1044 "
I can see "nonStoredPasswordParam" on dsl wiki. still figuring out how it works.
nonStoredPasswordParam('myParameterName', 'my description')
Will follow your question if we get any answer. Thanks!
Upvotes: -1