Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asking for passwords in Jenkins pipeline files

I have a Jenkinsfile that needs to ask for a password.

I have the following:

def password = input message: 'Please enter the password', parameters: [string(defaultValue: '', description: '', name: 'password')]

The problem is that the field shows up the characters in Jenkins when I type them in meaning anyone looking over my shoulder can see them.

The value is also logged clearly in the logfile.

Is there a way that I can:

  1. mask the characters as they are typed in the field?
  2. hide the value in the log file?
like image 647
wimnat Avatar asked Sep 19 '17 05:09

wimnat


1 Answers

Use a password parameter named ‘hidden‘ as following:

input message: 'enter password', parameters: [password(defaultValue: 'value', description: '', name: 'hidden')]
like image 78
hayderimran7 Avatar answered Oct 11 '22 04:10

hayderimran7