update.sh gerrit

Use the gerrit subcommand with the update.sh script to configure the hook files in the Git repository hosted in a Gerrit server.

Prerequisites

The update.sh gerrit subcommand requires that you installed hook files by using configure.sh gerrit. If the hook files are not present or were not installed through configure.sh gerrit, then this subcommand terminates.

Execute the gerrit subcommand in the system where the Gerrit server process is running. Command arguments that accept a file or folder path should be valid paths inside this system.

The gerrit subcommand assumes the default configuration of the Gerrit server. For more information on the default configuration, see Configuration.

Execute the subcommand as the operating system user who has write permissions to the Gerrit server installation directory.
Tip: You can run the ls -lcommand in the repositories folder to find the operating system user who owns the Gerrit server installation directory.
Tip: After you execute the subcommand, you can use the chown command to change the ownership of the hook files to the system user who owns the Gerrit installation directory.

Usage

cd EWM Git Integration Toolkit/tools/install 
./update.sh gerrit -g gerrit-install-directory [options]

Options

Option Description Required
-g/--gerrit-home gerrit-install-directory Absolute path to Gerrit installation directory. Yes
-t/--rtc-git-toolkit path Absolute path to EWM Git Integration Toolkit directory. By default, the parent directory containing this script is used as the toolkit directory. The toolkit directory path is updated in the pre-receive and post-receive hook files. You can provide a different EWM Git Integration Toolkit directory path, if required. No
-l/--trace-level trace-level Trace level for the hook file and Node.js scripts. Valid values are 1, 2, 3, and 4. The values map to the following logging levels : 1-ERROR, 2-WARNING, 3-INFO, 4-DEBUG. No
-u/--functional-user ID User ID or email ID of a functional user in EWM. This is used in post-receive hooks only. No
-n/--node-exec path Absolute path to the node executable. No
-a/--pre-receive Configure only the pre-receive hook file. If you want to install both pre-receive and post-receive hooks, do not specify this option. No
-z/--post-receive Configure only the post-receive hook file. If you want to install both pre-receive and post-receive hooks, do not provide this option. No
-p/--patchset-created Configure only the patchset-created hook file. No
-h/--help Displays this help message. No

Examples

# Display usage/help
cd EWM Git Integration Toolkit/tools/install
./update.sh gerrit -h
# Update hook files in a Gerrit server.
cd EWM Git Integration Toolkit/tools/install
./update.sh gerrit -t /opt/rtc-git-toolkit -g /gerrit -l 2 -n /usr/bin/node 
# Update hook files in Gerrit server (long options)
cd EWM Git Integration Toolkit/tools/install
./update.sh gerrit -–rtc-git-toolkit /opt/rtc-git-toolkit --gerrit-home /gerrit --trace-level 2 --node-exec /usr/bin/node