How to MaskPasswordsBuildWrapper in DSL?

938 views
Skip to first unread message

thomas....@teamaol.com

unread,
Apr 27, 2016, 5:31:15 AM4/27/16
to Jenkins Users
I created a masked password FOO with "1234".
Here my simple test DSL script:

node {
    stage "ONE"
   
    wrap([$class: 'MaskPasswordsBuildWrapper']) {
        echo "FOO=${FOO}"    
    }
}

Independent whether I check "Prepare an environment for the run" or not ...
I get this:

groovy.lang.MissingPropertyException: No such property: FOO for class: WorkflowScript
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)

Most probably I'm using it the wrong way.
Could you please help on this?

Regards,
Thomas




thomas....@teamaol.com

unread,
Apr 27, 2016, 5:40:53 AM4/27/16
to Jenkins Users
In addition to mention:

The "Snippet Generator" provides documentation on this:

Password Parameters, or any other type of build parameters selected for masking in Hudson's/Jenkins' main configuration screen (Manage Hudson > Configure System), will be automatically masked.

And also provide code generation. Even with specifying in the job
a name and a password doesn't work:

    wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: '4567', var: 'BAR']]]) {
        echo "BAR=${BAR}"    
        echo "FOO=${FOO}"    
    }

Result:
groovy.lang.MissingPropertyException: No such property: BAR for class: WorkflowScript
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)



Reply all
Reply to author
Forward
0 new messages