Inheriting workflow filters

workflow

#1

Currently I’m trying to port logic over to the Workflows system and I noticed odd behaviour if I specify a job that looks like this:

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - dependencies
      - lint:
          requires:
            - dependencies
      - test:
          requires:
            - dependencies
      - container_build:
          requires:
            - lint
            - test
      - staging_deploy:
          filters:
            branches:
              only:
                - master
      - release_to_production:
          type: approval
          requires:
            - staging_deploy
            - container_build
      - production_deploy:
          requires:
            - release_to_production

What I would expect is that release_to_production and production_deploy would not appear on non-master branches as there are required jobs further up the flow that aren’t allowed to run on this branch.

While I can replicate this behaviour by duplicating the filter in each job definition in the workflow, it definitely feels redundant to do that. It also seems like a concerning behaviour IMO as if something is marked as an prerequisite, I don’t consider that as something optional–it’s there for a reason, and shouldn’t be silently omitted.


#2