Feature: CI: Skip jobs when only some files/folders changed
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
Currently in GitLab CI it is not possible to skip specific jobs when only some files in a specific path changed, this proposal is meant to start discussion around this feature and how to best implemented it.
Basically the need is the following:
Imagine the following layout:
./
├── common/
├── mac/
├── windows/
├── some_file.c
├── …
In my CI I have a Windows and a macOS job, ideally I would not run the Windows job if there are only changes in the mac/ path and vice versa.
This could be accomplished with something like:
rules:
- if: true
changes:
- mac/**/*
when: never
However this only works at first glance, as while it would prevent the Windows Job to run when there are changes in mac/, it will additionally prevent it to run
when there are changes in windows/ and other files outside the mac folder, which is not desired.
The wanted behaviour is to skip this job when only files in mac changed, but still run it when files outside of mac changed. As far as I can tell this is
impossible right now to do with GitLabs rules:.
Proposal
Intended users
This will be incredibly useful for complex projects that want to skip some jobs of their CI that are not needed to run when only specific parts of the codebase changed.