Search code examples
gitlabcontinuous-integrationgitlab-cigitlab-ci-runnercicd

Why would a GitLab pipeline only run the last stage when triggered by a merge request?


The pipeline runs successfully with all stages when I click "Run pipeline" but when run for a merge request it only runs the last job which is the last stage. That last job has dependencies on the first 2 stages. There is at least 1 job in each stage that has no rules.


Solution

  • There is at least 1 job in each stage that has no rules.

    If a job has no rules, it won't run on a merge request pipeline. As noted in the documentation:

    Merge request pipelines:

    • Do not run by default. The jobs in the CI/CD configuration file must be configured to run in merge request pipelines.

    You need to make sure all your jobs are configured for merge request pipelines. The way you configure this is using rules:.