Monitor a repository in Jenkins, but don't pull

Apparently, there is no way to poll a github repository to start a Jenkins task and not download the aforementioned github repository.


While there is no way to poll a github repository to kick off a job without first pulling in the code for that job, you can work around this problem by using the jenkins multijob plugin to set up a multi phase job, configured as follows:

  • Configure a master job that resides in WORKSPACE-A. This job will poll the git repo you are monitoring. When a change is made, the job will pull the changes (which you won't use) and then proceed with the build, whose steps will be to kick off two other jobs in series.
  • Configure a second job to be triggered as the first build phase by the master job. This job will reside in WORKSPACE-B and it tracks no git repository. This job can do any of the pre-configuration you want. Because it exists in a workspace different from that of the master job, it will not be polluted by the source code from git.
  • Configure a third job to be triggered as the second and final build phase by the master job. This job may reside anywhere you need it to -- including WORKSPACE-A or WORKSPACE-B if that's what you want. You can either have this job track the same repo as the master job so that the changes are automatically pulled into the workspace, or copy the files already cloned from your git repo from WORKSPACE-A into this job's workspace.

Note: Only the master job should have a build trigger -- the one tied to changes to the git repo. The other two jobs will be triggered externally from the master job.