Created
August 13, 2019 15:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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