向已经提交 MR 的分支 push,会触发2个 pipeline,.gitlab-ci.yml 中 rules 写的是 always
rules:
- when: always
参考博文 Fix GitLab CI Duplicate Pipelines in Merge Requests when Using rules,通过 workflow
解决了
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
同时,去掉 job 中的 when: always
rules