Skip to content

Commit

Permalink
[SDPSUP-336] Added JIRA credential environment variables and dynamic …
Browse files Browse the repository at this point in the history
…prefix. (#368)
  • Loading branch information
conantran authored and dylankelly committed May 27, 2019
1 parent b5fac3c commit 241ac14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tasks:
name: Post deployed URL to JIRA
command: |
if [[ "$LAGOON_PR_HEAD_BRANCH" != "production" ]]; then
. scripts/jira-post-comment.sh $JIRA_ENDPOINT $JIRA_USERNAME $JIRA_PASSWORD $LAGOON_GIT_BRANCH sdpa $LAGOON_GIT_BRANCH "$LAGOON_PR_TITLE"
. scripts/jira-post-comment.sh $JIRA_ENDPOINT $JIRA_USERNAME $JIRA_PASSWORD $LAGOON_GIT_BRANCH $LAGOON_GIT_BRANCH "$LAGOON_PR_TITLE"
fi
service: storybook

Expand Down
15 changes: 7 additions & 8 deletions scripts/jira-post-comment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ JIRA_URL=$1
USER=$2
PASSWORD=$3
BRANCH=$4
PREFIX=$5
PR=$6
PR_TITLE=$7
PR=$5
PR_TITLE=$6

extract_issue() {
local prefix=$1
local branch=$(echo $2 | tr '[:upper:]' '[:lower:]')
local title=$(echo $3 | tr '[:upper:]' '[:lower:]')
local prefix=$(echo $branch|sed -n "s/feature\/\([a-zA-Z]\{1,\}\).*/\1/p")
local branch=$(echo $1 | tr '[:upper:]' '[:lower:]')
local title=$(echo $2 | tr '[:upper:]' '[:lower:]')
# Extracting from branch.
local issue=$(echo $branch|sed -n "s/feature\/\($prefix-[0-9]\{1,\}\).*/\1/p")
if [ "$issue" == "" ]; then
Expand All @@ -32,10 +31,10 @@ generate_data() {
EOF
}

ISSUE=$(extract_issue $PREFIX "$BRANCH" "$PR_TITLE")
ISSUE=$(extract_issue "$BRANCH" "$PR_TITLE")
[ "$ISSUE" == "" ] && echo "Branch does not contain issue number" && exit 0

COMMENT="Deployed to https://storybook-ripple-$PR.lagoon.vicsdp.amazee.io "
COMMENT="Deployed to https://storybook-ripple-$PR.lagoon.vicsdp.amazee.io"

echo "Posting comment \"$COMMENT\" for issue \"$ISSUE\""

Expand Down

0 comments on commit 241ac14

Please sign in to comment.