commit | 684eac4719beec0682c74a39ba18930af2fc0155 | [log] [tgz] |
---|---|---|
author | Daniele Sassoli <danielesassoli@gmail.com> | Sat Feb 08 15:24:47 2025 +0000 |
committer | Daniele Sassoli <danielesassoli@gmail.com> | Tue Feb 11 01:44:05 2025 -0800 |
tree | 18e3a2ede9cbe114bf5005d87d5fb67fb986fec7 | |
parent | 4af064feecc2181bd9f7a128f8edb6a1543f3917 [diff] |
Add the ability to access different SCM repositories For now, this is limited to GitLab, the intention is to extend this to other Git SCMs too. GitLab stores repositories under a different path from Gerrit, some logic is required to calculate the new path. When using GitLab backend, the project should be set to the GitLab Id of that project, rather than the name. The metric will be exposed with the project Id too. Further details on GitLab project ids at [1]. [1]https://docs.gitlab.com/ee/user/project/working_with_projects.html#access-a-project-by-using-the-project-id Change-Id: I68928a261e3a93feb7a489d44758d2e71bc729cc
This plugin allows a systematic collection of repository metrics. It‘s primary use-case is with Gerrit, however it’s possible for it to work with multiple Git SCM systems, including bare Git repositories.
Metrics are updated upon a ref-update
receive.
Clone or link this plugin to the plugins directory of Gerrit‘s source tree, and then run bazel build on the plugin’s directory.
Example:
git clone --recursive https://gerrit.googlesource.com/gerrit git clone https://gerrit.googlesource.com/plugins/git-repo-metrics pushd gerrit/plugins && ln -s ../../git-repo-metrics . && popd cd gerrit && bazel build plugins/git-repo-metrics
The output plugin jar is created in:
bazel-genfiles/plugins/git-repo-metrics/git-repo-metrics.jar
Copy the git-repo-metrics.jar into the Gerrit's /plugins directory and wait for the plugin to be automatically loaded.
This plugin can also work with Git repositories hosted by other Git based SCM tools, however the metrics are still expose via Gerrit, so a dedicated Gerrit instance running alongside the current SCM tool is still required. So to make this plugin work with other Git SCM tools, a Gerrit installation needs to be set-up and the basePath
needs to be set to the git data directory of the tool of choice. You will also need to set gracePeriod
and forceCollection
, as when using a different SCM tool than Gerrit the usual hooks aren't triggered. Finally, a configuration option will need to be specified to indicate which Backend is being used. Currently supported backend, other than GERRIT are:
Find more in the configuration section below.
More information about the plugin configuration can be found in the config.md file.