RuleBase: Read rules also from project config

So far, the rules defining the conditions and the actions affecting an
ITS issue were defined globally in <gerrit_site>/etc/its folder and all
the projects were subject to the same rules.

This can become a limitation as the handling of ITS issues can be very
different from one project to another, even if they use the same ITS.

Allow rules to be defined at the project level. As with the current
global rules, two files can be defined: 'actions.config' to define
general rules at the project level and 'actions-<its-name>.config' to
define rules specific to an ITS system. These files should be created in
the refs/meta/config branch and, similar with what happens now with the
global rules, the set of rules to be applied to an ITS issue is the sum
of the rules defined in the two files.

Once rules are defined at the project level, the global rules, i.e.,
those defined in <gerrit_site>/etc/its, no longer have effect in the
project; this means, the more specific rules take precedence.

As with other project defined configurations, inheritance is honored so
rules can be defined in a parent project. This inheritance, however, is
capped at the closest level, i.e., if a project defines at least one the
rules files, the presence of these files is not evaluated for any of the
project's parents.

Reading the project configuration to look up for rules every time an
issue is evaluated does not scale. Even if the ProjectLevelConfiguration
is already cached to avoid re-reading the repository, caching the rules
by project avoid re-parsing the configuration files and checking the
project inheritance for rules.

Change-Id: I2bb00a6c2687d41c9f4d8f73a0c0387ab3cb8834
8 files changed
tree: b59085fde1e0911774842bde6163ffe00d7622b3
  1. .settings/
  2. src/
  3. tools/
  4. .gitignore
  5. bazlets.bzl
  6. BUILD