Pipeline Event Merge Requests w/GitLab

Hello –

I am having issues getting my pipeline to trigger when a Merge Request is created in GitLab and am unsure if this is possible. I have two scenarios I would like to try out:

  1. Execute Drone pipeline once a Merge Request is created

OR

  1. Once the Drone pipeline succeeds create a Merge Request in Gitlab

For option 1) I have tried adding the following in my pipeline but unfortunately doesn’t kickoff the pipeline once I create a merge request in my branch_name:

kind: pipeline
type: docker
name: my-pipeline

trigger:
  branch: branch_name
  event: pull_request

I am unsure if this is the correct event type that I am looking for with my git hook.

Is there a way to accomplish either (or both) of these scenarios with Drone and GitLab?

Thanks!

I see two potential issues.

First is that event and branch are array values and should be adjusted accordingly:

trigger:
-  event: pull_request
+  event:
+  - pull_request

The second is that the branch field should probably be removed. This refers to the target branch of the pull request, not the source branch (this is a common misconception). If you try to filter based on source branch your pipeline will not be executed.

That was the exact issue (source branch misconception). Thank you for the help!