Automation Pipelines lets you trigger a pipeline when a code review occurs in your Gerrit project. The trigger for Gerrit definition includes the Gerrit project and the pipelines that must run for different event types.
The trigger for Gerrit uses a Gerrit listener on the Gerrit server that you will monitor. To define a Gerrit endpoint in Automation Pipelines, you select a project and enter the URL for the Gerrit server. Then you specify the endpoint when you create a Gerrit listener on that server.
The following procedure shows how to define a Gerrit endpoint that you can use in your Gerrit listener definition. In the event that you need to edit an endpoint, an optional step at the end of the procedure explains how and when to perform the update.
Procedure
- Define a Gerrit endpoint.
- Click and click New Endpoint.
- Select a project, and for the type of endpoint, select Gerrit. Then, enter a name and a description.
- If this endpoint is a business-critical component in your infrastructure, enable Mark as restricted.
- Enter the URL for the Gerrit server.
To use the default port, you can provide a port number with the URL or leave the value blank.
- Enter a username and password for the Gerrit server.
If the password must be encrypted, click
Create Variable and select the type:
- Secret. The password resolves when a user who has any role runs the pipeline.
- Restricted. The password resolves when a user who has the Admin role runs the pipeline.
For the value, enter the password that must be secure, such as the password of a Jenkins server.
- For the private key, enter the SSH key used to access the Gerrit server securely.
This key is the RSA private key that resides in the
.ssh directory.
- (Optional) If a passphrase is associated with the private key, enter the passphrase.
To encrypt the passphrase, click
Create Variable and select the type:
- Secret. The password resolves when a user who has any role runs the pipeline.
- Restricted. The password resolves when a user who has the Admin role runs the pipeline.
For the value, enter the passphrase that must be secure, such as the passphrase for an SSH server.
- Click Validate, and verify that the Gerrit endpoint in Automation Pipelines connects to the Gerrit server.
If it does not connect, correct any errors, then click
Validate again.
- Click Create.
- (Optional) Before updating a Gerrit endpoint to change a URL or private key for example, check to see if the endpoint is connected to a Gerrit listener.
- If the endpoint is not connected to a Gerrit listener, perform the following steps to update the endpoint:
- Click and click Open on the endpoint that you want to update.
- Update the endpoint definition.
- (Optional) If you are changing the cloud proxy, restart the old cloud proxy once to remove any old connections before starting the new cloud proxy and establishing a new connection.
- click Validate to verify that the Gerrit endpoint in Automation Pipelines connects to the Gerrit server.
- Click Save.
- If the endpoint is connected to a Gerrit listener, perform the following steps to update the endpoint:
- Disconnect any attached Gerrit listeners. See How do I use the Gerrit trigger in Automation Pipelines to run a pipeline.
- Perform the steps to configure the new endpoint.
- (Optional) If you are changing the cloud proxy, restart the old cloud proxy once to remove any old connections before starting the new cloud proxy and establishing a new connection.
- Validate and save the updated endpoint definition.
- Connect the Gerrit listeners again.
Note: If the Gerrit listeners do not disconnect, this might be because current Gerrit endpoint values have changed so that the listeners can no longer communicate with the Gerrit server. If this problem occurs, first make changes in the endpoint definition so that the listeners can communicate with the Gerrit server. Then disconnect the Gerrit listeners and reconnect them.