Skip to content

Instantly share code, notes, and snippets.

@SalmonKing72
Created April 4, 2019 13:02
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 SalmonKing72/a4b6f89fa4337fb9c48d19e35344bc8e to your computer and use it in GitHub Desktop.
Save SalmonKing72/a4b6f89fa4337fb9c48d19e35344bc8e to your computer and use it in GitHub Desktop.
Jenkins pipeline with credentials
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