From: Jessica Wagantall Date: Fri, 14 Jul 2017 07:02:39 +0000 (-0700) Subject: Validate URLs using Jenkins env variable X-Git-Tag: v0.5.0~4 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F5536%2F1;p=releng%2Fglobal-jjb.git Validate URLs using Jenkins env variable Since we are adding in Jenkins a variable JIRA_URL, we want to make the logic of this script so that it picks up its value to look for related URLs in the commit text rather than using a static value. Change-Id: Id6d1df4cfefa0d37f7f74a48d8d5149379ede3eb Signed-off-by: Jessica Wagantall --- diff --git a/shell/git-validate-jira-urls.sh b/shell/git-validate-jira-urls.sh index e542c450..a505d27e 100644 --- a/shell/git-validate-jira-urls.sh +++ b/shell/git-validate-jira-urls.sh @@ -20,7 +20,8 @@ set +u if [ -n "${JIRA_URL}" ]; then - JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io 'http[s]*://jira\..*' || true) + BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}') + JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true) if [[ ! -z "$JIRA_LINK" ]] then echo 'Remove JIRA URLs from commit message'