paul
paul

Reputation: 13516

How to trigger job when merging from releases/* to master?

We have 3 main branches: development, releases/xyz and master. This mirrors the flow from development through release candidates to production.

I want to trigger a job only when a merge request is made from releases/* to master. I need to block all other merge requests to master e.g. to prevent a merge directly from development to master.

Does Gitlab CI support a trigger ONLY when branch is master AND the originating branch matches releases/* ?

Upvotes: 0

Views: 257

Answers (1)

jelhan
jelhan

Reputation: 6338

GitLab does not support triggering a pipeline for merge commits only so far. Therefore it does also not support triggering a pipeline only for some merge commits.

There are two ways you might differentiate merge commits from normal commits:

  1. Merge commits have multiple parents.
  2. Merge commits have a standardized commit message in regular cases.

GitLab does not support filtering based on number of parents nor on the commit message (except for skipping CI with [skip ci] or [ci skip]).

You could find more information about support filtering options in the documentation for only and except options of GitLab CI/CD Pipeline Configuration.

Upvotes: 1

Related Questions