Logical OR for workflow `requires` stanza
s
sigrid.andersson@entur.org
We have a case where we wish to run api testing in the test environment before deploying to production. As it takes an amount of time for our application to start, we need some kind of delay between deploying and running said tests.
We can achieve this with either an approval type of job or the sleep job. For more flexibility it would be nice to continue the workflow if either of the two previous are complete
workflow: release: jobs: - build - release-test requires: - build - hold-for-approval type: approval requires: - release-test - run: sleep(600) name: wait-for-application-startup requires: - release-test - run-tests requires: either: - hold-for-approval - wait-for-application-startup
CCI-I-884
Canny AI
Merged in a post:
Add logic expresions to job requirements
D
David Navarro
Right now the requires key only takes a list of jobs, and their statuses, however it does not allow to include logical expressions like OR or AND.
For example if we have job A, B and C, we might want to run A and B in parallel and then add the following config to C:
requires:
-A
-B
This translates to "run C if A AND B succeed"
However what if we want to run the job C if A fails, OR B fails, right now all jobs in the requirements follow the AND logic, we should be able to add whatever logical expression we want:
requires:
- or:
- A:
failed
- B:
failed
T
Timothy c
My usecase is infrastructure creation and removal with Terraform and KOPS. Early in the creation process we need to perform DNS delegation. Late in the removal phase we need to run the same job.
Currently we must have a workflow per project / environment for create, and another for destroy. The CircleCI UI is starting to look a little cluttered.