Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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