Reputation: 66
How can I get the github API endpoint and scan-credentials id inside my pipeline Jenkinsfile to run Github API request.
I am using github organization folder plugin.
Upvotes: 3
Views: 1147
Reputation: 604
You use the "withCredentials" to expose the secrets. (Obviously echoing the secret out would be a bad way to keep it secret - but you could pass that secret on to other things that didn't print it out...)
withCredentials([[$class : 'StringBinding',
credentialsId : 'my_secret_token',
variable: 'GHE_TOKEN',
]]) {
echo "I can access my secret token of ${env.GHE_TOKEN} now"
}
Upvotes: 1
Reputation: 25481
You would need to have picked a mnemonic ID for the credentials, and then hardcode that in the Jenkinsfile
. At that point you can use the Credentials Binding plugin to retrieve the actual secret.
Upvotes: 0