Gerrit is a free, web-based team code collaboration tool.


We have a gerrit-client package that provides a thin wrapper around andygrunwald/go-gerrit, which is a go client library for accessing the Gerrit Code Review REST API

You can create a client instance by pass in a map of instance-name:project-ids, and pass in an oauth token path to start the client, like:

projects := map[string][]string{
 "": {

c, err := gerrit.NewClient(projects)
if err != nil {
 // handle error

The client will try to refetch token from the path every 10 minutes.

You should also utilize grandmatriarch to generate a token from a passed-in service account credential.

If you need extra features, feel free to introduce new gerrit API functions to the client package.


The adapter package implements a controller that is periodically polling gerrit, and triggering presubmit and postsubmit jobs based on your prow config.

Gerrit Labels

Prow adds the following Labels to Gerrit Presubmits that can be accessed in the container by leveraging the Downward API.

  • “”: SHA of current patchset from a gerrit change
  • “”: Numeric ID of the current patchset
  • “”: Gerrit label prow will cast vote on, fallback to CodeReview label if unset
          fieldPath: metadata.labels['']


The gerrit adapter currently does not support gerrit hooks, If you need them, please send us a PR to support them :-)