Rule to run a job only when file under some directory does NOT change

This rule will tell a job to run on merge request with change under docker/* directory

  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - docker/*

However, I want a negate condition of the above rule, is it possible?

@tanyagorn

If you do not want to run the job in this condition you add when:never to the rule.

  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - docker/*
      when:never

I hope this helps!

-James H, GitLab Product Manager, Verify:Pipeline Execution

1 Like

Thanks! It works like a charm.

1 Like