MON-490 add support to create version if does not exist
This commit is contained in:
parent
a4a42afd43
commit
96aea90bca
@ -107,14 +107,16 @@ if [[ "$answer" == "y" ]]; then
|
|||||||
echo -e "$(cat $TMP_CHANGELOG)${separator}$(cat CHANGELOG.md)" > CHANGELOG.md
|
echo -e "$(cat $TMP_CHANGELOG)${separator}$(cat CHANGELOG.md)" > CHANGELOG.md
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} editmeta $(head -n 1 $TMP_ALLOWED_ISSUES) --template=versions | grep $TAG_TARGET; then
|
read -p "Close all issues and fix version $TAG_TARGET ? (y/n): " -r answer
|
||||||
read -p "Close all issues and fix version $TAG_TARGET ? (y/n): " -r answer
|
if [[ "$answer" == "y" ]]; then
|
||||||
if [[ "$answer" == "y" ]]; then
|
# Create version if does not exists
|
||||||
for issue in $(cat $TMP_ALLOWED_ISSUES); do
|
one_issue=$(head -n 1 $TMP_ALLOWED_ISSUES)
|
||||||
echo jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} transition Close $issue
|
auth_header=$(printf "${JIRA_LOGIN}:${JIRA_API_TOKEN}" | base64)
|
||||||
echo jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} edit $issue --template=fixversion --override fixVersions=${TAG_TARGET} --noedit
|
if ! jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} editmeta $one_issue --template=versions | grep -q $TAG_TARGET; then
|
||||||
done
|
curl -H "Authorization: Basic $auth_header" -H "Content-Type: application/json" -X POST -d "{\"name\": \"${TAG_TARGET}\",\"userReleaseDate\": \"$(echo -n $(LANG=eng date +'%-d/%b/%Y'))\",\"project\": \"$(echo -n $one_issue | cut -d'-' -f1)\",\"archived\": false,\"released\": true}" ${JIRA_ENDPOINT}/rest/api/latest/version
|
||||||
fi
|
fi
|
||||||
else
|
for issue in $(cat $TMP_ALLOWED_ISSUES); do
|
||||||
echo "Impossible to close issues because version \"${TAG_TARGET}\" does not exists, please create it on JIRA"
|
jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} transition Close $issue
|
||||||
|
jira --endpoint=${JIRA_ENDPOINT} --login=${JIRA_LOGIN} edit $issue --template=fixversion --override fixVersions=${TAG_TARGET} --noedit
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user