ADD COMMENT API JIRA WITH VARIABLE

ygor mendes April 3, 2019

function parse_jira_ids(){
for ID in "$(echo $log | grep -Po '(TEST-([0-9]{1,}))')"
do
echo $ID

echo "${ID}" > $fileName.txt (WORKING ) ->  Write "TEST-1" in fileName.txt


JIRA_URL_1="https://jira.linx.com.br/rest/api/2/issue/TEST-1/comment"

JIRA_URL_2="https://jira.linx.com.br/rest/api/2/issue/$ID/comment" (NOT WORKING)

curl -k -u 'user':'pass' -X POST --data '{"body": "exemple" }' -H "Content-type: application/json" $JIRA_URL_1 >> aapost-commit.log 2>&1 (working )

curl -k -u 'user':'pass' -X POST --data '{"body": "$ID" }' -H "Content-type: application/json" $JIRA_URL_2 >> aapost-commit.log 2>&1 (NOT working )
done
}

2 comments

Comment

Log in or Sign up to comment
ygor mendes April 4, 2019

I am not do POST when i try send a variable. Some know why????

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2019

My best guess is that the $1 is not being expanded in your commands.  I'd try ${ID} instead of $ID

TAGS
AUG Leaders

Atlassian Community Events