wimnat
wimnat

Reputation: 1148

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?

Upvotes: 7

Views: 9032

Answers (1)

hayderimran7
hayderimran7

Reputation: 580

Use a password parameter named ‘hidden‘ as following:

input message: 'enter password', parameters: [password(defaultValue: 'value', description: '', name: 'hidden')]

Upvotes: 10

Related Questions