Trigger workflows via CircleCI REST API
complete
Mikhail Tymchuk
This feature is marked as completed, but I cannot find the way to trigger a workflow. In API v2 docs there is method to rerun workflow, not to run a new one.
N
Nathan Dintenfass
For reasons of backwards compatibility all workflows in a config run by default, so you will need to explicitly include/exclude those you want to run if you want to run only specific ones. This is known to be sub-optimal for cases where people want to configure many workflows and pick and choose which to run. If we see a lot of this kind of behavior we may add a way to switch the default behavior of running them all by default.
J
Jan Martin Langeland
I experienced a similar thing. When using the V2 pipeline API to trigger a workflow it kicked off all the workflows for that branch unless I specified
when: << pipelines.parameters.condition >>
in the workflow I wanted to kick off and unless: << pipelines.parameters.condition >>
in the workflows I don't want to start. Bug or expected behavior?M
Makarand Patwradhan
Hey Nathan, I am trying to use this v2 api to kick off my workflow. I have a question - how do I specify a branch when using this API? I tried to to POST to https://circleci.com/api/v2/project/github/twilio/twilio-video.js/pipeline?circle-token=xxxwith{ "branch": "my_branch" "parameters": { "run_release_steps": true, "run_stable_only": true }}
But saw that it kicked off the build against master. Where do I specify the branch in this new API?
N
Nathan Dintenfass
We are in preview for our v2 API that provides parameters when triggering pipelines. Rather than passing workflow name directly we have the ability to run workflows based on a boolean parameter (with more expressive conditionality coming later). To run a particular workflow you can thus set up a boolean parameter and pass that. Preview documentation for doing that can be found here: https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/conditional-workflows.md
I
Ilyapuchka
https://circleci.com/docs/api/v1-reference/#new-project-build has nothing about triggering WORKFLOWS and simply returns 404 on
api/v1.1/project/:vcs-type/:username/:project/build
More than that from its description it does not trigger arbitrary workflow, neither it can accept any parameters. So what's new? Can you please provide the doc that explains how to trigger ARBITRARY workflow by it's name with parameter. This was announced as implemented more than a year ago, still we are at the same place where we can't trigger any workflows with API.
K
Kenny Williams
Nathan, are there docs for the v2 conditional workflow endpoint? The regular API docs don't have any info on this new endpoint.
N
Nathan Dintenfass
We are currently previewing our v2 API that has a new feature to allow conditionally running particular workflows based on parameters passed when triggering your pipeline. See this preview doc for more information: https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/conditional-workflows.md
G
Gustavo Ambrozio
Seems like the link to the doc changes: https://circleci.com/docs/api/#trigger-a-new-build-by-project-preview
Also, I don't see how to "kick off a step within a workflow" like it was suggested. This would be the most important thing for us.
Load More
→