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 <jwagantall@linuxfoundation.org>
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'