Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to combine rules in gitlab ci/cd

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?

like image 224
xines61003 Avatar asked Mar 02 '23 02:03

xines61003


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/**/*
like image 99
urfin78 Avatar answered Mar 05 '23 17:03

urfin78