My Jenkins server is not receiving notification that the git server has changed content, and therefore not triggering the Multibranch Pipeline jobs.
The configuration is as follows:
The main git server is internet facing and running gitolite.
The Jenkins server is behind a firewall. The main git server does not have access to the Jenkins server, so git hooks will not work from this git server.
A git mirror exists on the Jenkins machine which acts as a read-only cache for Jenkins to reduce external bandwidth usage. I will just call this the cache in the rest of the description. The cache is being published internally using git-daemon.
The cache is updated by a Jenkins job that runs every 5 minutes to update it from the main git server using
git remote update
git fetch
- Existing freestyle projects simply poll the git cache to trigger themselves when changes appear in the cache. This works correctly.
The problem arises from recently created MultiBranch pipeline jobs. I cannot determine a way to trigger these jobs when the cache changes. I would prefer to use git hooks from the git cache and have tried setting up post-receive
hooks containing:
curl <jenkins server url>/git/notifyCommit?url=<cache url>/<project name>
Manually running this post-receive
does trigger the correct Jenkins jobs including the MultiBranch Pipeline ones, so the command within post-receive
is correct. But when the cache updates, that hook is not run. Is there any other hook I can use to trigger the build? If no hooks are appropriate, is there any way I set up a MultiBranch Pipeline job to poll the cache for changes?