Cross-workflow job dependencies
L
Lisa Luo
We have jobs with manual approvals at the end of our workflow for optional steps (for example, pushing an image to repository, which we only want to run in some cases). Right now, that makes it impossible for us to integrate the single workflow with GitHub status checks, since those are entirely workflow dependent and not job-dependent. For the time being, we've split it out into 2 workflows, but since the same jobs are run in both workflows, this creates a lot of unnecessary job duplication in order to create proper workflow dependencies.
Formerly (this doesn't integrate properly with GitHub due to manual approval):
Workflow-1: A -> { B, C, D, E } -> (F) -> (G) -> (E)
Becomes (with Workflow 1 integrated with GitHub):
Workflow-1: A -> { B, C, D, E }
Workflow-2: A -> { B, C, D, E } -> (F) -> (G) -> (E)
This spawns 5 extra jobs for each code push!
There are a few ways we could solve this problem, but none of them are currently supported in CircleCI:
1) Allow GitHub checks to integrate at the job level instead of at the workflow level (we would revert to Workflow-1 with status check depending on {B, C, D, E})
2) Allow GitHub checks to ignore jobs with type: approval ( https://circleci.com/ideas/?idea=CCI-I-445 )
3) Allow workflows to trigger other workflows (we would be able to skip A ... E if Workflow-1 triggered Workflow-2) ( https://circleci.com/ideas/?idea=CCI-I-273 )
4) Allow for cross-workflow job dependencies (similar to (3), with Workflow-1 triggering Workflow-2 and skipping A ... E)
CCI-I-1013
Nate Mellendorf
I've landed on this feature request a few times now, when googling a solution for cross workflow job dependencies for CircleCI. To solve for this (until something is made available from CircleCI), I use Python to hit the v2 API and check job statuses.
Here's my gist with more detail:
https://gist.github.com/natemellendorf/7bbc92c427d1d5bd8db8512cff0f8e60
I hope this helps someone / saves some time and digging!
D
Dovydas Rupsys
We have a build step that could be reused across multiple workflows. This might not seem like a lot but because we are building docker images, which is slow and inefficient to do in CircleCi, having this ability would use up fewer resources, but more importantly would allow us to control our deployments more accurately. An ability to do some thing like the following would be great.workflows: version: 2 setup-workflow: jobs: - build: context: org-global app-workflow: jobs: - deploy_to_staging: type: approval - staging-app: context: org-global requires: - setup-workflow.build - deploy_to_staging - deploy_to_production: type: approval - production-app: context: org-global requires: - build-workflow.build - deploy_to_production migration-workflow: jobs: - deploy_to_staging: type: approval - staging-migrations: context: org-global requires: - setup-workflow.build - deploy_to_staging - deploy_to_production: type: approval - production-migrations: context: org-global requires: - setup-workflow.build - deploy_to_productionIt doesn't look like it would even be a lot of new work, it is just an extension of the existing system.