From 9aacd8a21e0fac4177a189e9cf14113b6fbf72b7 Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Tue, 13 Jun 2017 10:43:39 -0700 Subject: [PATCH] lf-ci-jobs: Add git-validate-jira-urls.sh Across projects, we have commit messages being merged with jira URLs instead of the accepted format: Issue: - Jira URLs break the its-jira plugin making the link unaccessible from gerrit to the jira issue. Change-Id: Iecc82b34275d640549f974312bfba65fe3fa56f7 Signed-off-by: Jessica Wagantall --- jjb/lf-ci-jobs.yaml | 1 + shell/git-validate-jira-urls.sh | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 shell/git-validate-jira-urls.sh diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 358e7eb5..da8230fb 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -57,6 +57,7 @@ builders: - lf-infra-jjbini - shell: !include-raw-escape: + - ../shell/git-validate-jira-urls.sh - ../shell/jjb-install.sh - ../shell/jjb-verify-job.sh - ../shell/jjb-check-unicode.sh diff --git a/shell/git-validate-jira-urls.sh b/shell/git-validate-jira-urls.sh new file mode 100644 index 00000000..d44fec93 --- /dev/null +++ b/shell/git-validate-jira-urls.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# @License EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## + +# This script will make sure that there are no JIRA URLs in the commit +# message. JIRA URLs will break the its-jira plugin + +set -e -o pipefail +set +u + +JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io 'http[s]*://jira\..*') +if [[ ! -z "$JIRA_LINK" ]] +then + echo 'Remove JIRA URLs from commit message' + echo 'Add jira references as: Issue: -, instead of URLs' + exit 1 +fi -- 2.16.6