When configuring Gerrit project with file pattern, do not try to match COMMIT_MSG file.

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Description:
      I need to trigger a build only when a file in a specific directory is modified. When I configure regex with negative lookaround, it does not work in current situation.

      Example:
      Given there is a following directory structure:
      .

      -module1
      ---src
      -----main
      -------java
      -module2
      ---src
      -----main
      -------java
      -module3
      -module4
      ... a lot more modules ...

      When I make change in module1 only
      Then I do not want to trigger a build.

      Currently, the gerrit trigger plugin iterates over list of all modified files in commit, and tries to do a regex match.
      When I configure the regex as: "^((?!module1).)*$", it matches any file that does not start with "module1" string.
      However, since the commit always contains COMMIT_MSG file, it will match the regex and triggers the build.

      When we tried opposite approach, we run into a problem - since there are too many modules in the project, it would be very complicated and prone to error to list all paths that should trigger the build.

      It is either solvable as a modified regex pattern, ie "^((?!module1|\/COMMIT_MSG).)*$" , however it would be IMO more sane to omit the COMMIT_MSG file from checking. Proposed patch is attached.

            Assignee:
            rsandell
            Reporter:
            Milan Gerza
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: