Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get github API endpoint and scan credentials inside Jenkinsfile

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.

like image 528
mbelosto Avatar asked Jan 21 '26 21:01

mbelosto


1 Answers

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"
 }
like image 123
Ryan Avatar answered Jan 23 '26 14:01

Ryan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!