I have a Jenkins job foo that works perfectly well. It is authenticated with jenkins_foo_user. It is able to clone the repo and checkout the right branch.

In my codebase, I have another script - query_github.py a script used to query Github API to get information such as commits and pull request. To be able to use this API I need an access token.

I want to be able to use the jenkins user access token to authenticate and access the github credentials.

How do I do this?

Note: Using the Github Enterprise version

up vote 0 down vote accepted

You want the Credentials Plugin.

The administrator of the Jenkins instance can add the plugin, then add the credential (access token) that the job needs. Then, in the job, use the credential as a variable.

See the documentation for more details.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.