Circle 2.0 Workflow Filters Should be logical AND not OR

workflow
config
2.0

#1

Hi all, Circle 2.0 is great. However, the workflow filter functionality is somewhat broken for our particular deploy practice (which I think many others share), namely:

Releases should go out only when the commit is both tagged AND pushed to a particular branch.

We try to get this behavior by having a job named “deploy_production” which has the following gate filters for deploying to production (relevant section below):

  - deploy_production:
      requires:
        - build_and_push
      filters:
        tags:
          only: /^v\d+.\d+.\d+$/
        branches:
          only: /^release$/

What we want is to only run deploy_production when there is a tag matching the only regex AND when the branch is “release”. However, what we’ve observed is that this job runs when there is a tag matching the only regex OR when the branch is “release”.

This makes no sense given the way Circle 1.0 worked with respect to filtering portions of a build process/workflow, which behaved as a logical AND. I think most people expect for this to be more restrictive.

Can you create a way to have both filters be applied instead of either one? I’m sure it would make a lot of people happy.


My deploy job always runs, ignoring my tag filter
Workflow Job with Tag Filter being run for every commit
Laravel Forge Deployment upon successful build
#2

I agree, I have the same issue.


#3

Actually, you should have the option to choose. Something like this:

filters:
  and/or:
    - tags:
        only: /^v\d+.\d+.\d+$/
    - branches:
        only: /^release$/

#4

Completely agree. This behavior is very nonintuitive. Anyone from Circle care to discuss?


#5

I also would like to see this be AND by default or at the very least configurable, it was very surprising it behaved this way.


#6

+1 for logical AND


#7

Absolutely agree. Doesn’t make much sense to use OR.


#8

What about if the default stays OR for backward compatibility and there should be SCBbestof’s answer in any deep version. (and: or: tags: and: tags branches)


I have two workflows with opposite filters and both are run when I do a pull request; I would expect only one to run
#9

Agree with tbrock here, the current OR method provides too much room for error. I would also love (and need) to make use of an AND option.


#10

Also agree - OR seems really not useful. AND provides some real flexibility.


#11