I have a Jenkinsfile with a password parameter.
I need to pass this password to a downstream job (I don't even need to read it before passing it)
I expected the following code to work :
def downstreamJob = build job: 'myDownStreamJob', parameters: [
[$class: 'StringParameterValue', name: 'adminUser', value: params.adminUser],
[$class: 'hudson.model.PasswordParameterValue', name: 'adminPassword', value: params.adminPassword.value]]
But it fails with :
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use field hudson.util.Secret value
https://plugins.jenkins.io/permissive-script-security might be a workaround but it opens a big security hole, as it disables all the sandbox securities of all Jenkins builds.
I tried to pass the params
or params.adminPassword
objects themselves, but did not succeed