Trigger pipeline on Merge Request Approval

*Dear Forum, im triying to trigger a pipeline after the merge request gets approved.

Is that possible?

Thanks for any input

Hello Palumbo,

Is it possible with native .gitlab-ci.yml syntax? Unlikely.

Is it possible? Yes.

I’m unsure of what your use case is for this. Shouldn’t a MR reviewer/approver only approve a code change if it is passing a pipeline?

Are you expecting an external pipeline (not from your existing project) to be triggered when an MR gets approved?

Potential High Level View of a Solution

(This only is valid if you are talking about actual “approvals” and not :+1: added to MRs)

  1. Create a generic/bot user with an API token which has access to trigger pipelines for the respective projects.
  2. Deploy a webhook service that validates an MR event and approval and performs the desired triggering of a pipeline. (See a sample snippet of a golang server that adds comments when there is an approval here and in action here)
  3. Register the Webhook on your project with a Trigger for Merge Request Events.
  4. Profit? :dollar: :chart_with_upwards_trend:

This may not be what you need/is very complicated. (however it was fun making a webhook)

– tmos22