我有两个Gitlab回购协议:
-
项目A
-
项目A的集成测试
如果集成测试失败,我想停止project a的管道/构建,但当前,即使集成测试失败,管道a也通过了项目。
我的
.gitlab-ci.yml
对于项目A,定义了以下7个阶段:
stages:
- build
- test
- publish
- dev-deployment
- staging-deployment
- trigger-integration-tests
- prod-deployment
第二个最后阶段(
trigger-integration-tests
)使用
Gitlab API call
具有
curl
:
trigger-integration-tests:
stage: trigger-integration-tests
image: ubuntu:16.04
script:
- apt-get update && apt-get install -y curl
- "curl -X POST -F token=$INTEGRATION_TESTS_TOKEN -F variables[PROJECT_ID]=$CI_PROJECT_ID -F variables[BRANCH_NAME]=$CI_COMMIT_REF_NAME -F ref=master https://gitlab.mycompany.com/api/v4/projects/123/trigger/pipeline"
allow_failure: false
only:
- master
我试着加上
allow_failure: false
但那没用,所以我在找更多的主意。
我找到了
trigger-and-wait technique
但不确定是否有更简单的解决方案。