当 .gitlab-ci.yml 仅在合并请求中运行时,如何正确编写作业?
test_c:
stage: test
script:
- echo "This job tests something. It will only run when all jobs in the"
- echo "build stage are complete."
only:
- merge_requests
该作业不在合并请求中运行,但不在master或develop中的提交中运行。
Gitlab 文档建议使用“规则”而不是“仅”。您可以通过执行以下操作来仅完成 merge_requests:
test_c:
stage: test
script:
- echo "This job tests something. It will only run when all jobs in the"
- echo "build stage are complete."
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
https://docs.gitlab.com/ee/ci/yaml/#workflowrules https://docs.gitlab.com/ee/ci/yaml/#workflowrules
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)