gitlab-branch-source-plugin icon indicating copy to clipboard operation
gitlab-branch-source-plugin copied to clipboard

Trigger job when an MR is closed

Open albustax opened this issue 4 years ago • 3 comments

Hello Team,

Thanks for your good work ! Is it possible to trigger a job when an MR is closed ? I have enabled the Merge request events hooks on gitlab side but I can't trigger the job associated when the MR is closed.

Do I have a specific configuration to do ?

albustax avatar Feb 16 '21 19:02 albustax

I think the Job gets triggered (visible in logs), but it is a noop, since jenkins has already built the same version of the branch (only an assumption).

See https://github.com/jenkinsci/gitlab-plugin/pull/1001 in gitlab-plugin for reference. Could this be the same case for gitlab-branch-source-plugin?

manuschillerdev avatar Feb 23 '21 09:02 manuschillerdev

You're right, the job is triggered:

[Tue Feb 16 13:52:31 UTC 2021] Received Merge request !4 closed in project $PROJECT REMOVED event from $IP ⇒ https://$JENKINS_URL/gitlab-webhook/post with timestamp Tue Feb 16 13:52:31 UTC 2021

I agree with you, we need the same behaviour than gitlab-plugin and allow to force rebuild when the option is checked.

albustax avatar Feb 25 '21 11:02 albustax

Similarly, I'd like to trigger the pipeline when MR is approved. right now if i push an update to a branch and the pipeline fails, if i approve the merge request, the pipeline is not triggered again.

uchagani avatar Feb 17 '24 02:02 uchagani