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)
}

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'
)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With