API listing latest workflows
S
Sergio I
Cicle 2.0 is a great step forward, but the lack of API limits what we can do with workflows. It implies that we need to make a great deal of processing the jobs result to find the status of the Workflow (If all the steps succeeded, how log the whole workflow took, etc)Ideally it would work Similarly to the the already existing API endpointhttps://circleci.com/docs/api/#recent-builds-for-a-single-project
Having the same for workflows, and their basic details / status.
To get what is found in this page:https://circleci.com/gh/:organization/workflows
{ "status": "running" "jobs" : { "job_one": { "status": "running" }, "job_two" { "status": "dependecy_waiting" } ... }}
CCI-I-680
R
Radoslav Terezka
Not sure how people in CircleCI think, but this is another example of big failure in API v2! How could they just not integrate the endpoint for getting the list of recent builds? Yes, you can get the list of builds per project, but that's a no go for organizations having 50+ repositories. Spamming 50 project endpoints to construct the list of builds is a madness. Please, for a lord's sake, just port the recent builds endpoint from v1.1 to v2, please!
N
Nathan Dintenfass
The roundtrips are likely not going away in the v2 API because gathering all the data for each workflow would be too “expensive” on each call. It’s not an ideal experience, but it should be expressive enough to do what you need and can be wrapped into a script fairly easily. An orb that encapsulates that complexity is definitely a good idea.
S
Steven Harman
The v2 API, now in public preview, has a way to list recent pipelines by project, which would let you drill in to get workflows too
That's true, but it requires multiple round-trips to the CircleCI API, to then look up details of the Pipeline, so you can look up details of the Workflow(s). The ability to directly fetch "recent" Workflows for a Project, including the ability to filter that by Branch and status, would be fantastic and enable building Orbs to do things like:
Have a Workflow cancel itself if it's "in between" an actively running Workflow and a later Workflow. (e.g., avoid "Stacked Deploys")
A Workflow could cancel itself if another Workflow comes in close behind it as a sort of "debounce" to help prevent "Stacked Deploys"
Ensuring only a single Workflow is running at a time, e.g. https://github.com/eddiewebb/circleci-queue
N
Nathan Dintenfass
The v2 API, now in public preview, has a way to list recent pipelines by project, which would let you drill in to get workflows too. https://github.com/CircleCI-Public/api-preview-docs
G
George Speake
so important. please?