我有一个包含 3 个阶段的管道:build、deploy-test和deploy-prod。我希望阶段具有以下行为:
build deploy-test在其他分支上时自动运行master或在其他分支上手动运行deploy-prod上可用master我的管道配置似乎可以实现这一点,但在尝试将分支合并到主分支时遇到问题。我不想deploy-test在合并之前在每个分支上执行阶段。现在我需要这样做,因为合并按钮被禁用并显示一条消息Pipeline blocked. The pipeline for this merge request requires a manual action to proceed。项目中的设置Pipelines must succeed已禁用。
我尝试添加额外的规则以防止deploy-test阶段在合并请求中运行,但它没有改变任何内容:
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- when: manual
Run Code Online (Sandbox Code Playgroud)
全管道配置:
stages:
- build
- deploy-test
- deploy-prod
build:
stage: build
script:
- echo "build"
deploy-test:
stage: deploy-test
script:
- …Run Code Online (Sandbox Code Playgroud)