Skip to content

Instantly share code, notes, and snippets.

@alces
Created October 7, 2019 06:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alces/b57279f5154f7ff2efc730dbcbe3e201 to your computer and use it in GitHub Desktop.
Save alces/b57279f5154f7ff2efc730dbcbe3e201 to your computer and use it in GitHub Desktop.
Ask for password in Jenkins pipeline
pipeline {
agent {
label 'Linux'
}
stages {
stage('ask') {
steps {
script {
def askpass = input(
message: 'Please enter the password',
parameters: [
password(defaultValue: '',
description: '',
name: 'password')],
submitterParameter: 'submitter')
env.MY_USER = askpass.submitter
env.MY_PASSWORD = askpass.password
}
}
}
stage('run') {
steps {
sh("printenv | sort")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment