[CI] Pipeline fails when there are no jobs to be executed

Summary

I'm trying to configure the GitLab CI to run pipelines only for the master branch (i.e. exclude all other branches) until issue #23902 (moved) by @ayufan gets resolved. There is only 1 job in .gitlab-ci.yml and I'm using only to make the pipeline run only for the master branch. However this makes the pipeline fail because there are no jobs (which is expected when running in a branch different from master).

Steps to reproduce

  1. Create .gitlab-ci.yml file with only one job.
  2. Add only to limit the execution only when the condition is met (e.g. only for the master branch):
only:
        - master
  1. Trigger the pipeline while making sure that the condition is not met (e.g. in a branch different from master).

What is the current bug behavior?

The pipeline fails.

What is the expected correct behavior?

The pipeline should not fail when there are no jobs to be executed - it should be just skipped.

Relevant logs and/or screenshots

gitlab-pipeline-bug-ss01 gitlab-pipeline-bug-ss02

Output of checks

This bug happens on GitLab.com

Edited by Ignat Ignatov