Conditional statements not working with unless

I have the following setup in my config.yml:

parameters:
  deploy_mutably:
    type: boolean
    default: false
  deploy_immutably:
    type: boolean
    default: false

workflows:
version: 2.1
  deploy:
    unless:
      and:
        - <<pipeline.parameters.deploy_mutably>>
        - <<pipeline.parameters.deploy_immutably>>
...........

I have 2 conditions in my unless statement, and when I trigger the deploy job, deploy_mutably is false and deploy_immutably is true, but the deploy workflow still runs, when it shouldn’t. According to the docs it is okay to combine multiple statements under unless and indeed the config is evaluated to be valid. Not sure what I’m missing.

Docs: Configuring CircleCI - CircleCI

I was actually thinking of this incorrectly. To have a job not run with unless, both of the conditions would have to be true and in my case only one will be true at a time. Switching to using or did the trick.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.