How to combine rules in gitlab ci/cd

Viewed 2495

I would like to create rule for: changes in folder foo && branch = master && tag pushed

My current rules not working:

  rules:
    - if: $CI_COMMIT_TAG && '$CI_COMMIT_BRANCH == "master"'
    - changes:
        - foo/**/*

Looks like gitlab take like a OR.

What is wrong?

1 Answers

As stated in the gitlab documentation:

To conjoin if, changes, and exists clauses with an AND, use them in the same rule.

So it should be:

    rules:
      - if: $CI_COMMIT_TAG && '$CI_COMMIT_BRANCH == "master"'
        changes:
          - foo/**/*
Related