WIP: [RFC] Add complex policy paths to gitlab-ci
What does this MR do?
This is an RFC for a solution to #19232 (closed). This is not ready to be merged yet. This MR adds paths
complex policy for CI jobs. It allows running jobs only when changed files match given blobs. Example use:
build:
...
only:
paths:
- src/**
- Makefile
This checks the file changes for following cases:
- If pipeline is running against a merge request all the files changed between branch merge base and merge request diff head are included.
- If pipeline is running for the first time on branch all files in project at head are included.
- All file changes in current push (multi commit) are included.
It uses File.fnmatch
to match the glob to file names.
Are there points in the code the reviewer needs to double check?
I am not familiar with the gitlab internals. I am not sure if my way of finding the file changes is the best way. There might be corner case that this might miss. Though the code has been tested on local dev install and it works.
- Use of
before_sha
in pipeline. - Performance implications of
ls_files
.
Why was this MR needed?
This attempts to resolve #19232 (closed).
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a UX Designer -
Has been reviewed by a Frontend maintainer -
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Conform by the database guides -
If you have multiple commits, please combine them into a few logically organized commits by squashing them -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)
What are the relevant issue numbers?
Edited by Ashwini Dhekane