As per the documentation: Keyword reference for the `.gitlab-ci.yml` file | GitLab
I am trying to setup my pipeline to run when there is a merge request to “main” (default branch).
I am using GitLab SaaS.
My .gitlab-ci.yml looks like this:
include:
- local: 'aws/prod/.gitlab-ci.yml'
- local: 'aws/dev/.gitlab-ci.yml'
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- aws/prod/.terraform/
- aws/prod/.terraform.lock.hcl
- aws/dev/.terraform/
- aws/dev/.terraform.lock.hcl
stages:
- plan
- deploy
When I commit directly to main, everything works fine. But when I open a MR, the pipeline never executes. Instead, I’m stuck with a swirling “Checking pipeline status”.
I’ve tried not using the template and specifying workflow rules directly (at the top level .gitlab-ci.yml and lower level ones and a combination of both). I’ve used CI Lint to confirm everything looks good. I’ve tried using the if: $CI_PIPELINE_SOURCE == "merge_request_event"
rule. I’ve tried killing any MRs and branches and recreating from main. Nothing works.