Rules:changes, check entire merge request

I would like to have a CI job which executes in merge requests if that merge request changes certain files. It appears to me if I set rules:changes, it only checks whether the most recent commit edits those files, rather than anything in the branch being merged. I see in the documentation that is supported with “only:changes” (GitLab CI/CD pipeline configuration reference | GitLab) but this is unavailable to me because I use rules elsewhere.

Is there a way to achieve this using rules:changes?

I’m currently on self-managed 13.5.4-ee

This is not the expected behavior. The rules:changes evaluates all paths expressed in a merge request diff, i.e. the same set of files you see in the tree on the Merge Request’s Changes tab.

Do you have a sample project, or perhaps a list of steps that demonstrates your observed behavior?

Could you please also share relevant portions of the CI pipeline config in use on the project?

Thank you for your response.

It appears my diagnosis was incorrect. After some more prodding, I see now that my issue is the old version of gitlab. I was trying to use a variable in the changes field (something like rules: changes: $SOURCEDIR/**/*), but support for this was only added in 13.6.

I was searching for such an explanation in the documentation (here and here and here) and didn’t find it. I could only run certain jobs based only on paths in the last commit before moving to rules. This is a significant change when migrating jobs from only/except to rules logic and if only is to become deprecated, I believe there should be some logic to replace it.

This is not what is happening for me, I sent this MR mesa-ci-status: add "no space left on device" as infra error (!85) · Merge requests · gfx-ci / Mesa Performance Tracking · GitLab
and the jobs got created based on the previous commit, the changes didn’t take into consideration the difference with the target branch

This depends on the pipeline type you are using.

You have to use “merge request pipeline” so you have desired behavior: Merge request pipelines | GitLab