分支管道的“此管道没有阶段/作业”

nls*_*bch 8 pipeline gitlab-ci

鉴于以下情况.gitlab-ci.yml

---
stages:
  - .pre
  - test
  - build

compile-build-pipeline:
  stage: .pre
  script: [...]
  artifacts:
    paths: [".artifacts/build.yaml"]

lint-source:
  stage: .pre
  script: [...]

run-tests:
  stage: test
  rules:
    - if: '$CI_COMMIT_BRANCH == "$CI_DEFAULT_BRANCH"'
  trigger:
    strategy: depend
    include:
      artifact: .artifacts/tests.yaml
      job: "compile-test-pipeline"
  needs: ["compile-test-pipeline"]

build-things:
  stage: test
  rules:
    - if: '$CI_COMMIT_BRANCH == "$CI_DEFAULT_BRANCH"'
  trigger:
    strategy: depend
    include:
      artifact: .artifacts/build.yaml
      job: "compile-build-pipeline"
  needs: ["compile-build-pipeline"]
...
Run Code Online (Sandbox Code Playgroud)

配置应该始终运行(任何分支,任何源)。测试和构建作业应仅在默认分支上运行。

但是,不会为合并请求运行任何作业,并且在默认分支以外的分支上手动触发管道会出现错误No Jobs/Stages for this Pipeline

我尝试明确设置用于阶段rules: [{if: '$CI_PIPELINE_SOURCE'}]中作业的始终运行规则.pre,但没有骰子。

我究竟做错了什么?

nls*_*bch 6

根据文档

您必须至少在 .pre 或 .post 之外的一个阶段拥有一份工作。

在上面的配置中,除了 中的作业之外,不会.pre在合并请求事件中添加任何作业,因此根本不会添加任何作业。