How to configure Jenkins Gerrit Trigger to exclude file path?

Background

My git repository is hosted by a Gerrit server. We also use Jenkins along with the Gerrit Event and the git plugin to run jenkins automatic jobs when the recall is ported to Gerrit.

Say git repo has the following folder structure

ProjectA
    - .git
    - folderA
    - folderA/folderA1
    - folderA/manual_tests
    - folderA/manual_tests/file1
    - folderB
    - folderB/folderB1
    - folderB/manual_tests/file2
    - folderC
    - folderC/folderC1
    - folderC/manual_tests/file3
    - folderD
    - folderD/folderD1
    - folderD/folderD1/FolderD11
    - folderD/folderD1/FolderD11/manual_tests/file4
    - folderD/folderD1/FolderD12
    - folderD/folderD2

Currently, the Jenkins job is defined to run in all branches, specifying Type Pathwith a pattern **. This configuration causes the task to run with each scan.

Problem

Here is what I am trying to accomplish:

  • If the code review contains only the changes made to any folder manual_tests, I do not want Jenkins Jobs to start.
  • If the overview contains at least one file / folder that is not manual_tests, task trigger

File Path RegExp (?!.*manual_tests.*).*, . , .

Jenkins, gerrit manual_tests?

+4
2

Add Topic ​​.

screen shot from Gerrit

:

() , .

  • , .
  • , .
+1

, COMMIT_MSG .

: https://issues.jenkins-ci.org/browse/JENKINS-19891

, RegExp:

^((?!manual_tests|\/COMMIT_MSG).)*$
0

Source: https://habr.com/ru/post/1544398/


All Articles