Created
April 4, 2019 13:02
-
-
Save SalmonKing72/a4b6f89fa4337fb9c48d19e35344bc8e to your computer and use it in GitHub Desktop.
Jenkins pipeline with credentials
This file contains 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
node { | |
stage('GetUserCredential') { | |
// Requires Credential setup (MyCredentialID) | |
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'MyCredentialID', | |
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { | |
sh ''' | |
set +x | |
echo "$USERNAME" > output.txt | |
''' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment