|author||Luca Milanesio <email@example.com>||Fri Sep 24 21:53:25 2021 +0100|
|committer||Luca Milanesio <firstname.lastname@example.org>||Mon Sep 27 19:40:17 2021 +0000|
Clarify the scope of use for git-refs-filter Change-Id: I98612d5f3a26f45ebcb897527eebc2e9408622a9
Gerrit lib module to allow filtering out refs in the Git advertizing protocol phase.
Gerrit ACLs, Git's hideRefs and git-refs-filter are all tools for hiding refs from being visible to a remote Git client. However, the three tools have different scope and performance implications.
Use the Git's hideRefs when all Git clients need to be blocked from accessing some refs.
This method to hide refs is the fastest possible and has no performance implications.
The git-refs-filter is mostly used with CI systems to avoid the overloading of advertising and downloading a significant number of refs that would slowdown both Gerrit server and the Git client.
It is more flexible than Git‘s hideRefs because allows to define a limited group of users for hiding refs; it also allows to filter Gerrit NoteDb’s
/meta refs which would otherwise require a complex set of ACLs or plugins.
git-refs-filter is slightly slower than using Git's hideRefs and it does require the configuration of the change_notes cache in
gerrit.config to avoid potentially high overhead.
Use the Gerrit ACLs when you need to hide some of the refs on a per-project basis or when it is needed a very sophisticated pattern-matching of refs to be excluded.
This is the slowest way to hide refs and needs to be used only when a per-project ACLs policy is required.
Build this module as it was a Gerrit plugin:
git-refs-filterdirectory to Gerrit
bazel build plugins/git-refs-filter
bazel test plugins/git-refs-filter:git_refs_filter_tests
git-refs-filter.jarmodule is generated under
git-refs-filter.jar library to Gerrit
/lib and add the following one extra settings to
[gerrit] installModule = com.googlesource.gerrit.modules.gitrefsfilter.RefsFilterModule
The refsfilter module defines a new global capability called “Filter out closed changes refs”. By default the capability isn't assigned to any user or group, thus the module installation has no side effects.
Filtering a closed change refs has the following meaning:
To enable a group of users of getting a “filtered list” of refs (e.g. CI jobs):
NOTE Gerrit makes a super-simplified ACL evaluation if all the projects are globally readable (e.g. project has a READ rule to refs/*). To enable the closed changes filtering you need to disable any global read rule for the group that needs refs filtering.