Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

Cannot trigger Jenkins MultiBranch Pipeline jobs from a git mirror

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:

  1. The main git server is internet facing and running gitolite.

  2. 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.

  3. 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.

  4. 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
  1. 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?

question from:https://stackoverflow.com/questions/65920500/cannot-trigger-jenkins-multibranch-pipeline-jobs-from-a-git-mirror

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...