Skip to content

Installation

Per Ivar Gjerløw edited this page Apr 10, 2017 · 10 revisions

Installation of git-jira hook

The installation of the git-jira hook should be quite easy. The installation scripts have to be updated with key-value pairs of configuration settings and the changed files have to be made available for all developers of the team.
Below there is a short description of what the installation files does and which configuration properties have to be updated in order to make the git-jira hook work.

The requirements for running the hook is Java 8 Runtime Environment (JRE) and a bash terminal for installing the application.

Installation files

There are several bash scripts which is used when installing or uninstalling the git-jira hook.
install.sh
pre-commit
commit-msg
uninstall.sh

install.sh

This is used for installing the git-jira hook. It must be run for each developer of the team to be set up correctly.
The script is configuring the git config and copies the pre-commit and commit-msg hook to their correct location.

Update the GITHOOK_COMMON_PATH to point to the location of the installation files shown above.

pre-commit

This script contains a routine for updating the git-jira hook if a newer version exists. At the moment there are two ways for doing this; Nexus Repository Manager for large projects or using a plain old directory which have to be maintained manually.

Update the property git_hook_new_filename to the name of the jar file.
Example:
git_hook_new_filename=git-jira-hook-1.0.0.jar

Using Nexus Repository Manager

In order to use Nexus Repository Manager, the following properties inside the pre-commit script have to be set:

  • NEXUS_ADDRESS
  • NEXUS_REPOSITORY_NAME

Also uncomment the lines regarding Nexus and comment the latter one.

Using plain old directory structure

Update the GITHOOK_COMMON_PATH to point to the location of the installation files shown above.
Also comment the lines regarding Nexus Repository Manager.

commit-msg

This script executes the git-jira hook application when a developer commits code changes. There are no configuration settings.

uninstall.sh

This bash script is used for uninstalling the git-jira hook and remove the git configuration settings.

Other configurations

.gitignore

After preparing the installation files for a given git repository, you have to add the following to the .gitignore file.

  • debug.log

This file will be created by default when the git-jira hook is executed

Preparing the git repository

For a given git repository which will be using the git-jira hook the following changes have to be done in order to make use of the hook.

  1. Create a directory which the installation files will be added, e.g installation.
  2. Copy the files install.sh and uninstall.sh to the directory.
  3. Create a sub-directory which will contain the actual git hook files, e.g git/hooks
  4. Copy the files commit-msg and pre-commit to the sub-directory.
  5. Commit and push the changes to the git repository.

Make sure that the directory names matches the properties in the installation files

Changes in global and local git configuration

Global git config

These settings are set globally and is used for all git projects that are using the git-jira hook

[githook "jira"]
	username = <username used by JIRA>
	password = <password used by JIRA> <- This one is Base64 encoded.
        address = <the address to the JIRA instance> e.g https://jira.yourcompany.com

Local git config

These settings are set for each git project that's using the git-jira hook. The git-jira hook supports multiple JIRA projects which are configured by the projectkey property below.

[githook]
	language = en <- language code
[githook "jira"]
	projectkey = <JIRA project name>, e.g EXAMPLE
	projectkey = <JIRA project name>
	...

Standard location for the git-jira hook after installation

For each project that uses the git-jira hook the standard location is shown below.

---  (root of git project)
  |--- .git
  |  |--- hooks
  |  |  |- pre-commit
  |  |  |- commit-msg
  |  |  |--- util
  |  |  |  |- githook.jar
  |
  |--- installation
  |  |---git
  |  |  |--- hooks
  |  |  |  |- commit-msg
  |  |  |  |- pre-commit
  |  |- install.sh
  |  |- uninstall.sh

The file structure below installation directory are used when installing the git-jira hook. The files under the .git directory are used when executing git commands.