You can configure pre-receive hooks on the GitLab Community or GitLab Enterprise server
to enable process enforcement between GitLab and IBM® Engineering Workflow
Management (EWM).
About this task
On Linux, the Git repositories are located by default under
/var/opt/gitlab/git-data/repositories. The following steps assume that the
GitLab repositories are in this location. Repeat this task for each Git repository. If there are
existing hook scripts, manually merge the new scripts with the existing ones.
Procedure
-
Create a folder named custom_hooks under
/var/opt/gitlab/git-data/repositories/repository-name.
-
Copy the pre-receive hook file from
EWM-git-integration-toolkit-install-folder/server/hooks/examples/gitlab/pre-receive
to
/var/opt/gitlab/git-data/repositories/repository-name/custom_hooks.
-
Assign executable permission to the file:
chmod +x pre-receive
-
Open the pre-receive file in a text editor.
- Uncomment and set the following mandatory variables:
Variable |
Description |
RTC_GIT_SERVER_TOOLKIT_PATH |
Absolute path to the folder where the EWM Git
Integration Toolkit has been installed. |
GL_TOKEN |
Personal access token of a GitLab user. |
GL_SERVER |
The URL of the GitLab server. |
GL_INFO_FILE |
Instead of providing the values of GL_TOKEN and GL_SERVER,
you can add those values to a file and provide the path to the file. For instance, in Linux, create
a file under /opt/rtc-gitlab/tokenfile with the following content:
GL_TOKEN=<replace with token generated from gitlab>
Then set the value for GL_INFO_FILEto
/opt/rtc-gitlab/tokenfile.
|
You can also uncomment and set the following optional variables:
Variable |
Description |
NODE_EXECUTABLE |
Optional: Absolute path to the node executable. Required if node executable cannot be found
in the system path. |
RTC_GIT_SERVER_TRACE_LEVEL |
Optional: Logging level for the hooks. Set this value to 4 while you
set up the integration. Revert it after you validate the integration. |
VERIFY_GITLAB_SSL_CERT |
Optional: Set the value to true if the GitLab server's certificate
should be validated by the hook. Otherwise, set to false. The default is
true. This option applies only if the GitLab server is configured with
HTTPS. |