You can configure a webhook in a Gerrit repository to link work items to Git commits.
Perform this task for every Git repository in the Gerrit server.
Before you begin
In your Gerrit installation, ensure that you have installed the
webhooks plugin. IBM® Engineering Workflow Management
webhooks support only the patchset-created event. If you push changes directly to master branch or
any branch without review, this event is not triggered, and Git commit links are not created in the
work items.
A shared user base, such as a common LDAP, between Engineering Workflow Management and the
Gerrit server is optional. It is recommended to add an Engineering Workflow Management
functional user ID to the webhook configuration if the user base between Engineering Workflow Management and
Gerrit server does not match. Ensure that the functional user is authorized for Git
requests.
You must register every Git repository with Engineering Workflow Management to
enable linking of Git commits in that repository to Engineering Workflow Management work
items.
Procedure
-
In the web client, login to Engineering Workflow Management. For example, go to
https://host_name:9443/ccm/web.
- On the Engineering Workflow Management project page, click .
- Click Browse Registered Git Repositories.
- Select the repository that you registered.
- Expand the Hosting Server Configuration section.
- In the Hosting Server field, select
Gerrit.
- Click Copy next to the webhook URL.
- Click Save.
- Optional: If Gerrit and Engineering Workflow Management do not
share a user base, add a functional user ID for the webhook URL.
- Click Insert Functional User.
- Select the user and click OK.
- Click Copy next to the webhook URL.
- Click Save.
- Add the webhook URL to the Gerrit repository.
- Add the webhook plugin configuration to the Gerrit server config file under
Gerrit-installation-directory/etc/gerrit.config. Adjust the
values for the variables according to your requirement. If the configuration already exists, skip
this step.
[plugin "webhooks"]
connectionTimeout = 3000
socketTimeout = 2500
maxTries = 300
retryInterval = 2000
threadPoolSize = 3
- Add or update the webhooks.config file in the Gerrit project’s
refs/meta/config branch with the details of the Engineering Workflow Management webhook
URL and events for which the webhook should be triggered. Only the patchset-created event is
supported.
- Copy the following content and make changes according to your environment before
committing and pushing the changes. For the webhook URL value, use the URL that you copied in step 7
or step 9.c. If you set sslVerify to true, then the
Engineering Workflow Management
server certificate should be trusted by the Gerrit server.
[remote "ewm_webhook"]
Url = webhook URL copied in step 7 or step 9.c
maxTries = 1
sslVerify = true or false
event = patchset-created
- Re-load the webhook plugin for the new settings to take effect. For details, see plugin reload.