鉴于以下 .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
阶段的作业明确设置始终运行规则,但没有骰子。
我做错了什么?
答案 0 :(得分:0)