Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizrobertofreitas/c6f79d5479ff775acf0b79aa04741803 to your computer and use it in GitHub Desktop.
Save luizrobertofreitas/c6f79d5479ff775acf0b79aa04741803 to your computer and use it in GitHub Desktop.
Jenkins pipeline groovy script to get user and pass of an existing Jenkins credential
pipeline {
agent none
stages {
stage('First') {
steps{
script{
withCredentials([usernamePassword(credentialsId: 'credentialId', usernameVariable: 'username', passwordVariable: 'token')]) {
print 'token.collect { it }=' + token.collect { it }
print 'username.collect { it }=' + username.collect { it }
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment