From: Jessica Wagantall Date: Tue, 13 Jun 2017 17:43:39 +0000 (-0700) Subject: lf-ci-jobs: Add git-validate-jira-urls.sh X-Git-Tag: v0.4.0~9^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F5194%2F7;hp=14ff3601ee1c72496af243eca74ac269d26d6877;p=releng%2Fglobal-jjb.git 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 --- 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