CircleCI Ideas

allow empty workflow jobs

It would be useful to allow "empty" (need a better name) workflow steps with the following properties:

  • can take part in dependency chains, i.e.
    • can require other jobs to complete
    • can be required by other jobs to complete
  • no build steps and require no build agent to run (similar to "approval" jobs)

Such jobs could be useful in structuring and organising workflows.
They would save repetition allowing cleaner, DRYer workflow code
and the diagrams would be more unserstandable.

For example, imagine the following scenario:

  • 3 build steps which run in parallel
  • when all 3 succeed, you want 3 deploy steps to run in parallel

Currently you'd do it like this:

workflows:
version: 2.1
build_then_deploy:
jobs:
- build1
- build2
- build3
- deploy1:
requires:
- build1
- build2
- build3
- deploy2:
requires:
- build1
- build2
- build3
- deploy3:
requires:
- build1
- build2
- build3

 

The resultant, confusing diagram would look like this:

build1 --+-- deploy1
|
build2 --+-- deploy2
|
build3 --+-- deploy3

 

Adding an "empty" job would allow you to refactor, like this:

 

workflows:
version: 2.1
build_then_deploy:
jobs:
- build1
- build2
- build3
- builds_completed:
type: empty
requires:
- build1
- build2
- build3
- deploy1:
requires:
- builds_completed
- deploy2:
requires:
- builds_completed
- deploy3:
requires:
- builds_completed

The code is more natural to read and the diagram would be less confusing:

build1 --+                      +-- deploy1
| |
build2 --+-- builds_completed --+-- deploy2
| |
build3 --+ +-- deploy3
  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Feb 1 2019
  • Not planned
  • Attach files
  • Admin
    Nathan Dintenfass commented
    20 Feb 01:18

    It would be simple enough to add a "trivial" job that just echoes success to accomplish this. A longer-term solution might be to have other ways to add nodes to the workflow graph that aren't "jobs", but that's a ways out for us.