【问题标题】:"No Stages/Jobs jobs for this pipeline" for branch pipeline分支管道的“此管道没有阶段/作业作业”
【发布时间】:2021-06-07 12:58:16
【问题描述】:

鉴于以下.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"]
...

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

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

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

我做错了什么?

【问题讨论】:

    标签: gitlab-ci pipeline


    【解决方案1】:

    根据docs

    除了 .pre 或 .post 之外,您必须至少有一个阶段的工作。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多