Configuring web hooks to link patchsets to Engineering Workflow Management work items

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

  1. In the web client, login to Engineering Workflow Management. For example, go to https://host_name:9443/ccm/web.
  2. On the Engineering Workflow Management project page, click Source Control > Work with Git.
  3. Click Browse Registered Git Repositories.
  4. Select the repository that you registered.
  5. Expand the Hosting Server Configuration section.
  6. In the Hosting Server field, select Gerrit.
  7. Click Copy next to the webhook URL.
  8. Click Save.
  9. Optional: If Gerrit and Engineering Workflow Management do not share a user base, add a functional user ID for the webhook URL.
    1. Click Insert Functional User.
    2. Select the user and click OK.
    3. Click Copy next to the webhook URL.
    4. Click Save.
  10. Add the webhook URL to the Gerrit repository.
    Refer to the documentation for configuring the webhook plugin. The following steps are provided for quick reference:
    1. 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
    2. 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.
    3. 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 
    4. Re-load the webhook plugin for the new settings to take effect. For details, see plugin reload.