Configuring patchset-created hooks to link patchsets to Engineering Workflow Management work items

To enable linking of Gerrit patchsets to IBM® Engineering Workflow Management work items, configure a patchset-created script hook. Perform this task only once for a Gerrit server.

About this task

The Gerrit Node.js-based hooks are located in the Engineering Workflow Management -Git-integration-toolkit/server/hooks/examples/gerrit folder. The Gerrit hooks use the following scripts:
  • patchset-created.bat (on Windows systems)
  • patchset-created (on UNIX systems)

A shared user base between Engineering Workflow Management and the Gerrit server is optional for patchset-created hook. It is recommended to add an Engineering Workflow Management functional user ID to the patchset-created hook file if the user base between Engineering Workflow Management and the Gerrit server does not match. Ensure that the functional user is authorized for Git requests.

Procedure

  1. Copy the script to the Gerrit-installation-location/hooks folder.
    If hook scripts exist, then manually merge these hook scripts with the existing scripts.
  2. Add the following entries to the Gerrit configuration file, which is at Gerrit-installation location/etc/gerrit.config:
    • On Windows, under [hooks]:patchsetCreatedHook = patchset-created.bat
    • On UNIX, under [hooks]:patchsetCreatedHook = patchset-created
  3. Open the patchset-created or patchset-created.bat script in a text editor.
  4. Uncomment and set the following mandatory variables:
    Environment variable Description
    RTC_GIT_SERVER_TOOLKIT_PATH Absolute path to the folder where the Engineering Workflow Management Git Integration Toolkit has been installed.
    You can also uncomment and set the following optional variables:
    Variable Description
    NODE_EXECUTABLE Optional: Absolute path to the node executable. Required if the node executable cannot be found in the system path. Uncomment the variable and set the value.
    RTC_GIT_SERVER_TRACE_LEVEL Optional: Logging level for the hooks. Set this value to 4 while you up the integration. Revert it after you validate the integration. Uncomment the variable and set the value.
    REMOTE_USER Optional: If Engineering Workflow Management and Gerrit do not share a common user base, then provide a functional user ID. This user ID should be a valid Engineering Workflow Management user.
  5. For Linux or Unix systems, mark the ref-updated script as executable by running the following command: chmod +x patchset-created.
  6. Set the Git configuration properties user.name and user.email for the operating system user who owns the Gerrit process.