jenkinsci / jenkinsci/gitlab-plugin
Add filter filter on trigger
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 615
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 10
Description
Currently on each new commit to a MR a pipeline will be triggered, even the build is not always required.
**Example:**
* Source code will be changed => Pipeline should be triggered
* Readme will be updated => No need to test the source code
**Possibile solutions to retrieve changed files:**
* Run a git diff with `gitlabSourceBranch`& `gitlabTargetBranch` => requires a checkout
* Use aggregated list of modified/added/deleted files from [webhook](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#push-events)
**How to skip job**
* Option 1) Add an API to retrieve and maybe filter the aggregated file list, so you can skip stages via [when](https://www.jenkins.io/doc/book/pipeline/syntax/#when)
* Option 2) Add a new trigger filter (similar to the combination of `branchFilterType: 'NameBasedFilter'` with `includeBranchesSpec: '...'`)
Option 1 is more flexible, as you can e.g. skip some stages, but not all (e.g. run doxygen, but don't run tests). Option 2 has the benefit that a job can bypass the job queue, but requires to think also about what happens with the defined build within `gitlabBuilds`.
Contributor guide
Assessment
This issue has not been assessed yet.