The scenario: Our development team uses Jenkins for continuous integration, and some of our code is open source and therefore hosted at GitHub.com.
We have a local mirror of the relevant GitHub repositories, and our local GitBlit server is set to periodically poll the GitHub repositories to update the local mirror.
This "sort of works"; but the problem scenario is this:
Our current work-around for this problem is to set GitBlit to poll GitHub more often, but I don't like that as a solution since it causes more periodic/unnecessary traffic across the Internet, and still doesn't entirely avoid the potential for build failures, e.g. in the case where a developer pushes changes and then triggers a build immediately afterwards.
Is there a known "best-practice" solution for this problem that would automatically give us reliable Jenkins-build-behavior and also avoid constantly polling GitHub?
You can use a Github webhook to notify your local infrastructure about following events:
- A repository is pushed to
- A pull request is opened
- A GitHub Pages site is built
- A new member is added to a team
Do note that this will minimize delay however in some cases e.g. network problems or Github infrastructure partial outage it can still fail your build.
Setting Jenkins autobuild to update the local mirror before the build is probably the only safe solution.