On CircleCI, how can I trigger one build after another, but only if the first is green

扶醉桌前 提交于 2019-12-23 08:00:10

问题


I've managed to create a CircleCI build that triggers a subsequent build using their API using curl. I've added this to my circle.yml:

test:
 override:
  - mvn test -s settings.xml
  - mvn deploy -Prun-its -s settings.xml
  - curl -v -X POST https://circleci.com/api/v1/project/alexec/docker-maven-plugin/tree/master?circle-token=$CIRCLE_TOKEN

How do I trigger only if all of the previous steps are green?


回答1:


I think you should do this in the deployment section: Since this is - by definition - only run if everything is fine, this should do the trick.

See their documentation on deployment for details. There it says:

These commands are triggered only after a successful (green) build.




回答2:


You should have a requires variable in your job that you want to run only if the previous job has run. So you give the requires variable a value of the job name that you want to succeed first before the jobs resume running.

See this example: https://circleci.com/docs/2.0/configuration-reference/



来源:https://stackoverflow.com/questions/29904816/on-circleci-how-can-i-trigger-one-build-after-another-but-only-if-the-first-is

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!