In GitLab, I have made it so that when a Merge Request is created, it triggers Jenkins which builds the source branch.
(This is how I did it: In GitLab, I've added a webhook on a Merge Request, and in Jenkins, I've configured it to accept merge requests)
Problem is, if there's an Open Merge Request, and after a while someone assigns a user to that Merge Request, that will trigger the webhook and it will build the Jenkins job again, even though it's not necessary.
Is it possible to not have the Jenkins job triggered when a user is assigned to the GitLab Merge Request? (I couldn't find anything online and in Jenkins, it looks exactly the same in terms of the build and environment variables)
Thanks ahead!
CodePudding user response:
What works for me :
- I work on similar task last week but to avoid this behaviour I am executing my jenkins job after making comment on Open merge request
- Another solution could be trigger when branch merged [I had diff intentions so not implemented this way]
- Additionally I have made cmd result as mandatory parameter
- Because once merge request created there might be many commits by diff team-members, diff comments. So keep looping to avoid this is not good solution
- Lastly I reported the execution result in same merge request & this serves my concern
- For reference you can go through Webhook Trigger plugin
CodePudding user response:
Resolved: https://i.imgur.com/cY9cyci.png
Just check this box with the one above it...