How do I setup Jenkins to see all private GitHub repos within our organization?

7/19/2017

How do I set up Jenkins so that every time a developer creates a new repo on Github within the organization, Jenkins is able to access it? So that the developer DOES NOT need to go into the repo's setting page on Github to find the right webhook, deploy keys, or integration & services.

For example, after a developer creates a new repo on Github (where the owner is the organization), I want the developer to be able to do the following on Jenkins:

  • Developer goes to our Jenkins website (which runs off Kubernetes/Helm), creates a new Jenkins project, clicks "Add Source", selects "GitHub" or "Git" for the source (whichever works), and Jenkins is able to find that repo and trigger builds/tests based off commits to that repo

Jenkins is already able to do this for public GitHub repos, because when I type in the username under Owner, the Repository drop down updates with a list of repos. (See screenshot) But I want to be able to do this for a private organization.

For example, when I type in tensorflow as owner: enter image description here

-- gunit
continuous-integration
git
github
jenkins
kubernetes

1 Answer

7/22/2017

You will need to tell Jenkins about your GitHub OAuth token, as described in the GitHub plugin manual; there is a dedicated section on that page for how to tell Jenkins to auto-add itself to the GitHub repos

-- mdaniel
Source: StackOverflow