Gitlab-CI and Pipelines: How to Trigger a Pipeline Based on a Merged Branch Event?

Hello,
First of all I hope I am writing to the correct group. Please redirect me if I am not.

We have a need to auto-deploy our projects to various server instances at the time their corresponding branches are merged back to the develop branch.

That is the use case I am uncertain how to address using gitlab and pipelines, etc. Since it is triggered by the merge event, I don’t know for sure how to 1) listen for those events, and 2) where/how to capture the steps (currently manual bash scripts0 to perform the deployment activities and post-deployment (e.g. starting containers, etc.) activities.

I am basically familiar with AutoDevOps, but I do not need anything to fancy for the time being. We are not using Kubernetes and my understanding is that you need Kubernetes for AutoDevOps.

I would grateful for any general or even specific guidance on how to proceed. thanks!

1 Like

Do I get this right:

  • You want to do something only in the first pipeline run to the target branch, but not in e.g. a daily scheduled pipeline of the same branch?
  • Maybe create a release at the end via API which creates a tag automatically and check for the tag firstly in the pipeline. If the tag does not exist, you know that this is the first run for the commit in the dev branch.