Attempting to run

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.

Hi @WesleyDavid - I’m curious why the development job is ignoring master, if by your own requirements it should be run for master?

Hmm, perhaps my understanding of what triggers a job and what filters do is twisted up somehow.

So in my case, development_job should run alone on commits to branches. It should be the required precursor of production job on commits to master.

I’ve got some documentation deep diving scheduled so we’ll see how snarled up my understanding is. :smile:

Yeah, I was vastly… vaaastly overthinking things here. It should simply be:

workflows:
  version: 2
  test_then_maybe_deploy:
    jobs:
      - development_job
      - production_job:
          requires:
            - 'development_job'
          filters:
            branches:
              only: 'master'

Problem exists between keyboard and chair. :smile: