下面的 .gitlab-ci.yaml 配置中 backend-test 与 frontend-test 失败了,deploy-to-staging 依然会执行
deploy-to-staging:
stage: staging
needs:
- build-staging-images
- backend-test
- frontend-test
通过 gitlab 上的 issue Job incorrectly runs after failure of needed job with rules: when: always set 找到了解决方法,将 rules 中 的 always
改为 on_success
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: on_success