Use internal server context for group member resolution Replace the hardcoded Account.id(1000000) with oneOffRequestContext.open() for resolving group membership in OWNERS files. On instances where that account does not exist, hidden groups silently return no members. oneOffRequestContext.open() uses Gerrit's InternalUser, which bypasses group visibility checks in GroupControl.canSeeMembers(). This is the same approach used by findUserOrEmail() in this file. Discussed in [1]. [1] https://groups.google.com/g/repo-discuss/c/1Kua6hWszDA/m/PSjubQ4zBAAJ Change-Id: I66d2740ef3d228bc19889a1449d5bd0c98240451
This repository contains the basic infrastructure and API for building and running two separate plugins, owners and owners-autoassign.
It provides the ability to parse the OWNERS file format and it's parsing across branches and repositories.
This plugin is built with Bazel in Gerrit tree
Create symbolic links of the owners-common-api folderd and of the external_plugin_deps.bzl file to the Gerrit source code /plugins directory.
Then build the owners-common-api plugin with the usual Gerrit plugin compile command.
Example:
git clone https://gerrit.googlesource.com/plugins/owners-common-api git clone --recurse-submodules https://gerrit.googlesource.com/gerrit cd gerrit/plugins ln -s ../../owners/owners-common-api . ln -sf owners-common-api/external_plugin_deps.bzl.MODULE.bazel . cd .. bazel build plugins/owners-common-api
The output is created in
bazel-bin/plugins/owners-common-api/owners-common-api.jar
To execute the tests run:
bazel test plugins/owners-common-api/...
This project can be imported into the Eclipse IDE:
Add the plugin name to the CUSTOM_PLUGINS (and in case when you want to run tests from the IDE to CUSTOM_PLUGINS_TEST_DEPS) in Gerrit core in tools/bzl/plugins.bzl file and run:
./tools/eclipse/project.py