Merge "lf-ci-jobs: Add git-validate-jira-urls.sh"
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 19 Jun 2017 18:36:55 +0000 (18:36 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Mon, 19 Jun 2017 18:36:55 +0000 (18:36 +0000)
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