Configuring the Git repository and hooks by using scripts

The IBM® Engineering Workflow Management (EWM) Git Integration Toolkit includes scripts to add EWM Git integration configuration variables, and install and configure hook files in Git repositories hosted in Node.js, GitLab, Gerrit, and Bitbucket servers.

The EWM Git Integration Toolkit includes two scripts, configure.sh and update.sh, which you use with subcommands that are specific to the Git hosting server.

Prerequisites

You must have the following programs installed and included in the PATH environment variable.

  • bash
  • getopt
  • git
  • sed
  • node or node.js
Note: In Ubuntu Linux, the node executable is named nodejs.

You can use these scripts only on Git repositories that have not been configured.

Logging

Three of the scripts include a logging trace level parameter. Set the parameter to one of the following values.

Table 1. Logging trace levels
Trace level Description
0 No logging.
1 Errors
2 Warnings
3 Informational
4 Verbose

configure.sh

Use this script to add EWM Git Integration configuration variables and install the hook files in the bare Git repositories of Git hosting servers.

Note: The script configure.sh can be used only to add EWM configuration variables and install hook files. If the configuration variables or hook files already exist, the script terminates. Use the update.sh script to update EWM configuration variables and hook files.

Execute the script in a bash shell. Navigate to the EWM Git Integration Toolkit/tools/install directory.

Usage

./configure.sh [sub command] [options]

Subcommand Description
git Adds the EWM Git configuration variables rtc.repokey and rtc.repourl in the Git repository’s config file. You must execute this subcommand for Git repositories hosted in Node.js, GitLab, and Gerrit servers, in addition to installing the hook files by using the other subcommands, to have a working EWM Git Integration.
nodejs Installs the hook files in a Git repository hosted in a Node.js server.
gitlab Installs the hook files in a Git repository hosted in a GitLab server.
gerrit Installs the hook files in a Gerrit server.
Bitbucket Installs the hook files in a Git repository hosted in a BitBucket server.

update.sh

Use the update.sh script to update EWM configuration variables and update values inside hook files.

Note: The update.sh script can be used to update EWM configuration variables and values inside hook files only if they were previously installed through the configure.sh script. If the configuration variables or hook files do not exist or were not installed through the configure.sh script, the update.sh script terminates.

Execute the script in a bash shell. Navigate to the EWM Git Integration Toolkit/tools/install directory.

Usage

./update.sh [sub command] [options]

Subcommand Description
git Updates the EWM Git configuration variables rtc.repokey and rtc.repourl in the Git repository’s config file. The variables were previously configured through the configure.sh git command.
nodejs Updates the hook files in a Git repository hosted in a Node.js server. The hook files were previously installed through the configure.sh nodejs command.
gitlab Updates the hook files in a Git repository hosted in a GitLab server. The hook files were previously installed through the configure.sh gitlab command.
gerrit Updates the hook files in a Gerrit server. The hook files were previously installed through the configure.sh gerrit command.
Bitbucket Updates the hook files in a Git repository hosted in a BitBucket server. The hook files were previously installed through the configure.sh bitbucket command.