Conditional manual approval steps in workflows
Robert Wiesner
This request is almost as old as this CD 😜
Michael Baentsch
Hi Ami -- did you get any feedback from the CircleCI team? How did you resolve things? Please see my comment below for how I tried (and failed). Did you finally remove manual approval as it is useless in a more automated setting?
Suhas Vishwanath
My use case is that I want to be able to show or hide the manual approval job based on a pipeline parameters.
We usually auto deploy to lower environments.
We want manual approval only when with an explicitly set pipeline parameters allows deployment to higher environments.
A simple conditional manual approval step will help.
Michael Baentsch
Suhas Vishwanath: This is exactly also our use case. What did you do now? We tried with
- cond-testapproval:
requires:
- precondition-job
when:
equal: [ false , << pipeline.parameters.run_downstream_tests >> ]
type: approval
- macOS:
requires:
- cond-testapproval
but to no avail: Our pipeline-triggered jobs still hang :-(
Suhas Vishwanath
Michael Baentsch: our resident IaaC guru asked us to leave things be. all pipelines with manual approval step run upto manual step and hang. i wonder whose CPU cycles we've been wasting.
I have moved on from the project where this was necessary.
Michael Baentsch
Suhas Vishwanath: Thanks for letting me know.
Sandy W
You can now call the API to approve a manual approval job: https://circleci.com/docs/api/v2/#operation/approvePendingApprovalJobById . So, you can combine this with a conditional step in a prior job.
A
Anthony
Sandy W: This API looks great, but it would be able to approve a prior step by name in another job/step in plain YML. Atm now I have to figure out how to write a script to get the approval step id from the API and then post my approval to it. Calling CircleCI api's inside a circleci pipeline seems a little unnecessary lol.
Am I missing something? Surely if this API exists then there must be a feature for it?
James Crowley
Also here because of the terraform use-case (only want the manual approval step when there are changes to apply)
R
Rob Grant
I got here through Google because I also have a Terraform use case.
P
Peter Br�ndum
Any updates on this one ?
J
Joshua Kleckner
Would love this. We have a lerna monorepo and with more work than I'm happy with have been able to get it all going thanks to circleci existing flexibility (we only test and build packages that changed). The last part is publishing new versions: I'd like to have manual approvals for production releases of only builds that have actually happened.
E
Eddie Bachle
We also are interested in this from the perspective of a terraform approvals workflow. I want the terraform plan command to do a state comparison on every run, but would prefer if users didn't have to manually approve when there are no changes detected.
E
Eric Dahlseng
This also would be helpful for running Terraform jobs. Right now our infrastructure workflow is split into several different pieces, each one consisting of a plan, approval, and apply step. If the plan step shows no drift, however, then it would be great to skip the approval step, so that it's easy to tell whether or not the entire workflow succeeds or not (right now there are a lot of pending approval steps for each run).
Load More
→