blob: 4e93da1c2e5d3fe8f23d39643ff93657702a6b32 [file] [log] [blame]
Ben Rohlfsab7fbbf2021-04-29 10:27:03 +02001:linkattrs:
2= Gerrit Code Review - JavaScript Plugin Checks API
3
4This API is provided by link:pg-plugin-dev.html#plugin-checks[plugin.checks()].
5It allows plugins to contribute to the "Checks" tab and summary:
6
7image::images/user-checks-overview.png[width=800]
8
9Each plugin can link:#register[register] a checks provider that will be called
10when a change page is loaded. Such a call would return a list of `Runs` and each
11run can contain a list of `Results`.
12
13The details of the ChecksApi are documented in the
14link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/api/checks.ts[source code].
15Note that this link points to the `master` branch and might thus reflect a
16newer version of the API than your Gerrit installation.
17
18If no plugins are registered with the ChecksApi, then the Checks tab will be
19hidden.
20
21You can read about the motivation, the use cases and the original plans in the
22link:https://www.gerritcodereview.com/design-docs/ci-reboot.html[design doc].
23
24Here are some examples of open source plugins that make use of the Checks API:
25
26* link:https://gerrit.googlesource.com/plugins/checks/+/master/gr-checks/plugin.js[Gerrit Checks Plugin]
27* link:https://chromium.googlesource.com/infra/gerrit-plugins/buildbucket/+/master/src/main/resources/static/buildbucket.js[Chromium Buildbucket Plugin]
28* link:https://chromium.googlesource.com/infra/gerrit-plugins/code-coverage/+/master/src/main/resources/static/chromium-coverage.js[Chromium Coverage Plugin]
29
30[[register]]
31== register
32`checksApi.register(provider, config?)`
33
34.Params
35- *provider* Must implement a `fetch()` interface that returns a
36 `Promise<FetchResponse>` with runs and results. See also documentation in the
37 link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/api/checks.ts[source code].
38- *config* Optional configuration values for the checks provider.
39
40[[announceUpdate]]
41== announceUpdate
42`checksApi.announceUpdate()`
43
44Tells Gerrit to call `provider.fetch()`.