I’m attempting to think my way out of job dependency hell, and not having much luck so far. My desire seems simple:
-
I want to have every commit to a branch run through my CircleCI development job.
-
I want to have every commit to master run through both the CircleCI development job, and then my CircleCI Production job if the development job succeeds.
My workflow is thus:
workflows:
version: 2
test_then_maybe_deploy:
jobs:
- development_job:
filters:
branches:
ignore: 'master'
- production_job:
requires:
- 'development_job'
filters:
branches:
only: 'master'
In the above config, my “development_job” runs on any commit to any branch in the repo except master. Great! That’s what I want.
However, no CircleCI job runs on any commit to master.
If I comment out production_job’s requirement for development_job, then production_job runs on every commit to master, naturally.
I think that production_job is ignored when the requirement for development_job exists is because of course development_job is not run because of the branch filter ignoring master. The “production_job” then cannot run. It seems to be a bit of a chicken and egg scenario.
How would I make any commit to master also require the “development_job” is run successfully first? I never want a commit to master to not be checked with the development_job. I’m thinking I may need multiple workflows, or a “development_job2” that’s just a copy and paste of the original one with no filter.