Skip to content

Add "compare_to" to rules:changes

Furkan Ayhan requested to merge 293645-changes-compare into master

What does this MR do and why?

This is the final step of adding the compare feature to rules:changes. In "compare" you can write the ref that you want to compare with for the changed files.

This MR targets the branch of !90171 (merged)

Step Status
1. Move CI rules-changes to an entry class !89463 (merged)
2. Refactor CI rules entry to use composed value !90238 (merged)
3. Add rules:changes:paths alias to rules:changes !90171 (merged)
4. Implement rules:changes:compare 👈 You are here

Related to #293645 (closed)

These changes are behind a feature flag ci_rules_changes_compare #366412 (closed).

Screenshots or screen recordings

Example config:

test2:
  script: exit 0
  rules:
    - changes:
        paths:
          - README.md
        compare_to: main

Test 1: Create a new branch with no change

Screen_Shot_2022-06-28_at_14.45.47

No pipeline is created

Test 2: Create a new branch with a change on another file

Screen_Shot_2022-06-28_at_14.47.08

No pipeline is created

Test 3: Create a new branch with a change on README.md

Screen_Shot_2022-06-28_at_14.48.08

Yay 🎉

Screen_Shot_2022-06-28_at_14.48.37

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports