Hello, I just recently dived to CircleCI and I’m trying to achieve something what seems to be common but can’t find resources about it nor did I find it in the docs. Is it possible to run another workflow after the main workflow finishes successfully with a git branch condition that is not via schedule since I want to run it right away? Basically I don’t want all workflows specified in the config to run concurrently. Take the example config below, I want to run
deploy_test workflow after
ci workflow finishes only on the
test git branch. Same for
deploy_prod workflow after
ci workflow finishes but against the
workflows: version: 2.1 ci: # ...jobs deploy_test: # ...jobs deploy_prod: # ...jobs
Ultimately, the goal is I want to reuse jobs (same job name) and pass parameters to it while having a branch/tag filter on the workflow level rather than creating individual jobs (job name with probably a suffix) for each environment on a single workflow and having each job keep repeating the branch/tag filters. Maybe using some sort of
trigger could do the trick here but I’m not sure how to pull that off. There’s also the
when but it doesn’t seem to track the status of another workflow. Or probably a support for
requires option on a workflow level similar to what we have on jobs under a workflow currently would be succinct.
I could move things down to commands but then the “namespacing” (suffix) of the environments now moves to the jobs level and the condition for
branches can now exist on two places, jobs and workflows. Also the former doesn’t have
tags filter while the latter does. I want to keep the branch/tag filters in a single level and I think the workflow is the best place but I don’t want them to run concurrently so yep. Is there a way to achieve running workflows sequentially? If not, then I’d like to verify, is it common practice or expected to have the jobs know the environment (e.g. test, staging, prod) they’re operating on?
Thanks in advance!