Skip to main content

Gerrit connections

The gerrit connection type represents a Gerrit code review host and its Gitiles endpoint. It has multiton cardinality and uses the host lookup strategy.

Configure Gerrit​

app-config.yaml
connections:
- type: gerrit
host: gerrit.example.com
baseUrl: https://gerrit.example.com
gitilesBaseUrl: https://gerrit.example.com/plugins/gitiles
auth:
- method: basic
username: ${GERRIT_USERNAME}
password: ${GERRIT_PASSWORD}

Connection fields​

FieldTypeRequiredDescription
hoststringYesGerrit host matched against the consumer's resource URL.
baseUrlstringNoBase URL of the Gerrit instance.
gitilesBaseUrlstringYesBase URL used to access repositories through Gitiles.
cloneUrlstringNoAlternative base URL used to clone repositories.

Authentication methods​

MethodFieldTypeRequiredDescription
noneNone——Does not accept authentication fields.
basicusernamestringYesGerrit username.
basicpasswordstringYesGerrit password.

Use none explicitly when Gerrit and Gitiles permit unauthenticated access.

Lookup and selection​

The consumer supplies a lookup query containing a Gerrit URL. The service selects the connection whose host matches the parsed URL host exactly.

When more than one authentication entry is visible to the calling plugin, the first visible entry is selected. Use plugin scoping to supply different credentials to a specific plugin; otherwise, configuration order determines which entry is selected.

Consume a Gerrit connection​

const connection = await connections.find({
type: 'gerrit',
query: { url: 'https://gerrit.example.com/c/acme/example/+/123' },
authMethods: ['basic', 'none'],
});

connection.gitilesBaseUrl; // string
connection.cloneUrl; // string | undefined

Return to the built-in connection type index.