Skip to content

Instantly share code, notes, and snippets.

@spartan
Created September 10, 2019 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spartan/871351d37cdea2422f6f9ed672acc9eb to your computer and use it in GitHub Desktop.
Save spartan/871351d37cdea2422f6f9ed672acc9eb to your computer and use it in GitHub Desktop.

Connect Jira w/ GitLab

Docs

https://docs.gitlab.com/ee/user/project/integrations/jira.html#configuring-gitlab

Steps

  1. Create a Jira user/pass
  2. For each GitLab project setup the Jira Integration (Settings -> Integrations)
  3. Commit message now starts with PROJ-12 prefix

Example commit hook:

#!/usr/bin/env bash
INPUT_FILE=$1
START_LINE=`head -n1 $INPUT_FILE`
PATTERN="^(PROJ)-[[:digit:]]+: "
if ! [[ "$START_LINE" =~ $PATTERN ]]; then
  echo "Bad commit message, see example: PROJ-12: commit message"
  exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment