Is it possible to do branch-level filtering for a workflow rather than the individual jobs in a workflow?
My current workflow looks like this:
workflows:
test_and_deploy:
jobs:
- run_bare_tests
- deploy_staging:
requires:
- run_bare_tests
filters:
branches:
only: staging
- qa_staging:
requires:
- deploy_staging
# FILTERING IS REPEATED AND HARD TO READ
filters:
branches:
only: staging
- merge_staging_to_master:
requires:
- qa_staging
# FILTERING IS REPEATED AND HARD TO READ
filters:
branches:
only: staging
- deploy_master:
requires:
- merge_staging_to_master
filters:
branches:
only: master
But I would ideally like it to look like this:
workflows:
test_and_deploy_staging:
# NOTE THE FILTERING HERE AND DECLARED JUST ONCE
filters:
branches:
only: staging
jobs:
- run_bare_tests
- deploy_staging:
requires:
- run_bare_tests
- qa_staging:
requires:
- deploy_staging
- merge_staging_to_master:
requires:
- qa_staging
# EACH WORKFLOW IS MUCH EASIER TO READ
test_and_deploy_master:
filters:
branches:
only: master
jobs:
- run_bare_tests
- deploy_master:
requires:
- run_bare_tests
Is this possible? I assumed that workflows were going to be different ways of setting up workflows for different scenarios. Without the ability to filter on a workflow level though I get the impression that I should really only think of there as being one workflow.
This single-workflow and per-job filtering syntax is much harder to read. Is there something I’m missing?
Thank you,
Peter