Reputation: 722
I use Jenkins pipeline for my deployments. During the installation you need to pass credentials. I was able to successfully mask password in Jenkins console logs using:
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: userElabPassword.toString(), var: 'userElabPassword'], [password: userJumpServerPassword.toString(), var: 'userJumpServerPassword']]]) {
Unfortunately I don't know how to apply masking to a Stage View which still display unmasked passwords:
Is it a bug? Or should I configure it somehow?
Versions used:
Pipeline: Stage View Plugin: 2.19 Mask Passwords Plugin: 2.13 Jenkins: 2.263
Upvotes: 1
Views: 1505
Reputation: 893
There is a ticket in the Jenkins Jira with more examples how to handle this. https://issues.jenkins.io/browse/JENKINS-59214
Upvotes: 2
Reputation: 722
I solved it by using sshpass with -e flag and passing credentials via environmental variable. That way I completely avoid using password in command line, therefor it is not visible in Pipeline Stage View plugin log box. Not working password masking in this plugin is still an issue though.
Upvotes: 0
Reputation: 21
If you are using string interpolation like the following
sh "password ${PASS}"
Try to replace it with
sh 'password $PASS'
https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation
However, this can only work for an environment variable. PASS in my example above.
Upvotes: 0