lf-ci-jobs: Add git-validate-jira-urls.sh 94/5194/7
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Tue, 13 Jun 2017 17:43:39 +0000 (10:43 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 19 Jun 2017 18:28:22 +0000 (18:28 +0000)
Across projects, we have commit messages being
merged with jira URLs instead of the accepted
format: Issue: <JIRAKEY>-<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 <jwagantall@linuxfoundation.org>
jjb/lf-ci-jobs.yaml
shell/git-validate-jira-urls.sh [new file with mode: 0644]

index 358e7eb..da8230f 100644 (file)
@@ -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 (file)
index 0000000..d44fec9
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# @License EPL-1.0 <http://spdx.org/licenses/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: <JIRAKEY>-<ISSUE#>, instead of URLs'
+  exit 1
+fi