1

I'm using Jenkins with private git repository manager.I created a multibranch pipeline to do CI.

I have use Basic Branch Build Strategies plugin to run pipeline when tag push event occurred.I also add Change Request in the Build Strategies part.

When i create a merge request on the private git repository manager platform. I can saw the Merge Requests Events webhook has sent to ${jenkins_url}/git/notifyCommit?url=${git_repo_url}. But the pipeline doesn't trigger by the merge request event.

enter image description here

I also try use refspec to capture the merge request event with following settings:

enter image description here

It still doesn't work. I'm not familiar with Jenkins. Can you help me how to achieve this object?

enter image description here

stamaimer
  • 6,227
  • 5
  • 34
  • 55
  • do you see the `Build Triggers` section? And what is your Jenkins version? – nghiahoang Jul 18 '20 at 17:35
  • Please specify git tool name eg. `GitLab` or `GitHub` etc. – mdabdullah Jul 18 '20 at 19:54
  • @nghiahoang I haven't saw the `Build Triggers` in `Multibranch pippeline/Branch Sources/Git`. – stamaimer Jul 20 '20 at 01:24
  • @mdabdullah I'm not use `GitHub` or `GitLab`. I chosse `Git` option in `Multibranch pippeline/Branch Sources`. The git repository which i use is a private develop product. It also support send webhooks when `Push`, `Tag Push`, `Note`, `Issues`, `Merge Requests`, `Review` events ocurred. – stamaimer Jul 20 '20 at 01:27
  • @nghiahoang The version of Jenkins is 2.235.1 – stamaimer Jul 20 '20 at 05:18
  • To simplify, can you first integrate your Git to a normal Freestyle job and see if a webhook push actually triggers it? Also since you are using `Git` plugin with a private Git not sure how helpful others can be, but seeing the documentation `https://plugins.jenkins.io/git/` it looks like you may need to add this line of code to your `curl http://yourserver/git/notifyCommit?url=` to your Git Server. – mdabdullah Jul 20 '20 at 05:20
  • @mdabdullah I have already add `${jenkins_url}/git/notifyCommit?url=${git_repo_url}` on my git server. `Push Events` and `Tag Push Events` can successfully trigger the multibranch pipeline. Only the `Merge Requests Events` can't. – stamaimer Jul 20 '20 at 06:12
  • Thanks @stamaimer , in `GitLab` and `BitBucket` the webhook section provides explicit options to select `event-based` triggering as shown in this image `https://confluence.atlassian.com/bitbucket/files/735643732/922649152/3/1586991105544/add_webhook.png`. Since you are using a `In-house built Git Repo` you need to check how to configure these options at the repository level, does your `git` have a GUI? OTOH, you can use `Poll SCM` option to run every 5 minutes (cron schedule) so once a merge is complete, Jenkins will check the repo 5 minutes and job will be triggered automatically. – mdabdullah Jul 20 '20 at 07:00
  • @mdabdullah I'm sure when a merge request event occured. The git server sent the signal to Jenkins. But Jenkins doesn't response to this signal. I have update the picture in the question. – stamaimer Jul 20 '20 at 07:53
  • Ok @stamaimer looks good, in that case you need to enable `debug` level logging in Jenkins and see what happened to the merge event and its 40-digit commit ID. Have you considered using the `Poll SCM` option I have suggested? Cos it seems a simpler workaround than debugging this. – mdabdullah Jul 20 '20 at 10:00

0 Answers0