问题
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