-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger build when merge request has been merged #390
Comments
What is the use-case for running a build after a MR is accepted? |
Was coming here to ask about this. My particular use-case is I want to automate clean up of deployed feature branches after a merge request has been merged. Since I didn't see an explicit trigger for "merged" I thought perhaps it would come through under the gitlabActionType as "MERGED" - but that doesn't appear to be the case. This is also assuming that gitlabSourceBranch is sent down so I can determine the correct feature to clean up. |
According to the current GitLab doc, the MR web hook should be, "Triggered when a new merge request is created, an existing merge request was updated/merged/closed or a commit is added in the source branch." So it would seem like if you have an MR webhook triggering your Jenkins job, the job should run when an MR is merged or closed. It could be that the plugin ignores those events because in theory it would already have built them. @dennyferra isn't there an option in GitLab to remove a branch after it is merged? |
Yes that option does exist, however I wanted to run a script to clean up our feature branch environment as well (not just the branch). Perhaps I can do this with a git hook. |
@coder-hugo can you comment on whether the plugin ignores 'MR close' events? I can imagine that it might... |
I have confirmed that we ignore MR close events. Reference the code here. I think that we would want to add an option to support triggering on MR close, so it's not always enabled, so this would require more than just a one-line change. I will mark it as a feature request if someone wants to implement it. |
@omehegan Ok, there is already a merge request out there. What's the state with the reviews? I could review it otherwise |
@mreichel if you want to review that PR, that would be great :) |
Hi, I would like to know how to configure this on my Jenkins ? I am also need to build after the merge request is accepted. I am new with Jenkins things. It would be great to know about how to do it step by step. Thanks |
@adityosnrost the current version of the plugin can trigger a build, after a merge request is accepted/merged because a push event will happen. If that's what you want, you can take a look at the Readme file, where the configuration is explained in detail and hopefully serves well as a step by step introduction. The new feature described in this thread is not yet released. To use it now, you would need to build the plugin from source. |
Hello, @mreichel Thanks for your reply. So, basically for this version, I just listen to push event on the targeted merge branch, right ? |
@adityosnrost Yes, that should work. The build will be triggered once the pull requests is merged/pushed onto the target branch. |
Hi. Is there any example how to trigger on merged/closed hook? For me it does not work. It is invoked push webhook instead. |
Add DS_Store
Is it possible to trigger a build if a merge request has been merged? Although the gitlab webhook description says the "Trigger when merge request is merged" but no build is triggered.
Is there any way to configure a job/gitlab to achieve that?
The text was updated successfully, but these errors were encountered: