Skip to content

Unexpected empty skipped MR pipeline when CI is skipped preventing merges

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

(Summarize the bug encountered concisely)

Starting with GitLab 15.2, a customer observes that an empty skipped MR pipeline is created when [skip ci] (or -o ci.skip) is used. This breaks the Merge when pipeline succeeds functionality because the most recent pipeline is skipped.

  • It is possible to configure GitLab so that skipped pipelines are considered successful by Merge when pipeline succeeds (MWPS).
    • This is not desirable because we want to know that a non-skipped pipeline completes successfully.

Steps to reproduce

  1. Create a project with .gitlab-ci.yml like what's shown below
  2. Create an MR
  3. Push a commit to the source branch with the merge request option to skip ci set
  4. Observe that an empty skipped MR pipeline is created

Example .gitlab-ci.yml

- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report. If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)

What is the current bug behavior?

An empty skipped MR pipeline is created.

What is the expected correct behavior?

The behavior observed prior to GitLab 15.2 should be restored:

  • the empty skipped MR pipeline should not be created

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise.)

Possible fixes

The customer points out the MRs linked below with this note:

The changes were to add support for push options being passed into merge request pipelines: !87030 (merged) and https://gitlab.com/gitlab- org/gitlab/-/merge_requests/87323. The issue seems to be that the order in which the pipeline is built means that skip is evaluated before the workflow rules: https://gitlab.com/gitlab- org/gitlab/-/blob/master/app/services/ci/create_pipeline_service.rb#L25 (line 19 and 25). Now that push options are passed through it now decides the pipeline needs to be skipped before it gets as far as evaluating workflow rules.

Similar Issues

Workaround

The customer is presently working around this problem with the following approach which may be of use to others who are impacted by this problem:

  • When committing, include -o ci.variable=CI_SKIP=true
  • Modify .gitlab-ci.yml to include:
- if: $CI_SKIP
  when: never

📚 Docs

Edited by 🤖 GitLab Bot 🤖