ChecksUpdate: use ChangeIndexer to index changes

We saw in the logs thrown exceptions on this code path with message:
  * AuthException: maintain server not permitted

This was because the current code delegated to ChangeApiImpl which calls
Index (see [1]), which in turn checks that the calling user has the
'Maintain Server' global capability and fails. This failed the POST
request to update checks.

Updating the code to use ChangeIndexer instead.

[1] https://gerrit.googlesource.com/gerrit/+/88f26343b13560d4c75b25a77a59427972c1c91a/java/com/google/gerrit/server/restapi/change/Index.java#44

Google-Bug-Id: b/250877007
Change-Id: Iea638a383ecfc7ddf6a3b46ccc6a005eb5cd3aea
1 file changed
tree: 74bad8386ebaa792250c05b2365f8d8661d4233c
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. web/
  6. .gitignore
  7. .gitreview
  8. BUILD
  9. LICENSE
  10. README.md
README.md

DEPRECATION NOTICE

The Gerrit team at Google has decided to discontinue work on the checks plugin. The recommended solution is [https://gerrit-review.googlesource.com/Documentation/pg-plugin-checks-api.html](Checks UI) which surfaces results from an external CI/analysis system.

Gerrit Code Review Checks Plugin (DEPRECATED)

This plugin provides a unified experience for checkers (CI systems, static analyzers, etc.) to integrate with Gerrit Code Review.

When upgrading the plugin, please use init:

java -jar gerrit.war init -d site_path

More details about “init” in https://gerrit-review.googlesource.com/Documentation/pgm-init.html

Enable e-mail notifications

To enable sending email notifications for “checks” status updates, you'll need to create the email templates in <your-site-path>/etc/mail. In the simplest form, simply rename the example templates:

cd "<your-site-path>"
mv etc/mail/CombinedCheckStateUpdated.soy{.example,}
mv etc/mail/CombinedCheckStateUpdatedHtml.soy{.example,}

JavaScript Plugin

For running unit tests execute:

bazel test --test_output=all //plugins/checks/web:karma_test

For checking or fixing eslint formatter problems run:

bazel test //plugins/checks/web:lint_test
bazel run //plugins/checks/web:lint_bin -- --fix "$(pwd)/plugins/checks/web"

For testing the plugin with Gerrit FE Dev Helper build the JavaScript bundle and copy it to the plugins/ folder:

bazel build //plugins/checks/web:checks
cp -f bazel-bin/plugins/checks/web/checks.js plugins/

and let the Dev Helper redirect from .+/plugins/checks/static/checks.js to http://localhost:8081/plugins_/checks.js.