Mask userid and password from jenkins.

How to hide svnuser and password credential from console output.

  • Go to  Jenkins > credentials > system > Global credentials
  • Click on Add Credentials on left menu

1

  • Enter against Username field and Password field.(it might appear with some filled values but you can clear it and enter your value) and save.
  • Click OK
  • No go to your Jenkins job.
  • Go to Build Environment >> select “Use secre text(s) or file(s)
  • Bindings section will appear and select Username and password (separated)

2

  • Enter your username variable and password variable.
  • Select your credentials for these variables from credentials drop down.
  • Now go to Build section >>Advance
  • And set up as below

3

  • Click Apply and Save

Go to your gradle code and modify retrieve your param like this

 

      println USER_E_NAME

svnuser = USER_E_NAME

svnpassword = USER_E_PASSWORD

println USER_P_PASSWORD

 

 

and in console output print will be

 

****

****

In SvnInfo(svnuser, svnpassword, repoUrlForInfo)

 

You good to go now

 

Published by sbcons

Sbcons has expertise in different areas of SDLC, provide solution, services and consultancy to all type of industry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: