2

I need to hide some values in Jenkins pipelines. I've created some libraries with classes that handle some common operations. The problem is some of these classes execute commands with sh but it shows sensitive information. My problem is I cannot use withCredentials because I don't have this credentials stored in Jenkins(they come from yaml files in the repository and are decrypted with a library). Is there a way to use withCredentials without having the credentials stored in jenkins? Could say to jenkins to hide some values?

I need something like:

maskVariables([var1: 'secret value 1', var2: 'secret value 2']) {
   pipeline.sh('echo "don't show $var1 $var2"')
}

//don't show ************** **************

  • Does this answer your question? [Hiding password in Jenkins pipeline script](https://stackoverflow.com/questions/42371909/hiding-password-in-jenkins-pipeline-script). See the second answer using the [Mask Password Plugin](https://plugins.jenkins.io/mask-passwords/) – Noam Helmer Mar 18 '22 at 14:06

0 Answers0