我正在尝试使用“规则”和“仅”关键字来定义合并请求、推送到开发分支和推送到主分支之间的管道行为。
我注意到 Gitlab CI 中有几个奇怪的行为,让我们在我的 merge_requests 管道中看看。
image: "python:3.8"
stages:
- test_without_only_policy
- test_with_only_policy
test_without_only_policy:
stage: test_without_only_policy
when: manual
script:
- echo "Yay, I am in the pipeline"
test_with_only_policy:
stage: test_with_only_policy
script:
- echo "I am always in the pipeline"
Run Code Online (Sandbox Code Playgroud)
一切都按预期进行,很棒
image: "python:3.8"
stages:
- test_without_only_policy
- test_with_only_policy
test_without_only_policy:
stage: test_without_only_policy
when: manual
script:
- echo "No, I am not in the pipeline anymore"
test_with_only_policy:
stage: test_with_only_policy
only:
- merge_requests …Run Code Online (Sandbox Code Playgroud) continuous-integration continuous-deployment gitlab gitlab-ci cicd