You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I would like to execute a curl query inside my bitbucket pipeline.
The issue I have is using the variable in the pipeline.
Here is my code
- |-
curl --location --request POST "https://xxx.atlassian.net/rest/api/3/issue/"${TICKET_NAME}"/comment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $JIRA_API_TOKEN" \
-H "Cookie: atlassian.xsrf.token=$JIRA_COOKIE_TOKEN" \
--data-raw "{ \"body\": {\"type\": \"doc\",\"version\": 1,\"content\": [{\"type\": \"paragraph\",\"content\": [{\"text\": \"$PREVIEW_LINK\",\"type\": \"text\"}]}]}}"
The problem is `TICKET_NAME`, `PREVIEW_LINK`, `JIRA_COOKIE_TOKEN`, `JIRA_API_TOKEN` are not replaced....
I tried
"https://xxx.atlassian.net/rest/api/3/issue/"${TICKET_NAME}"/comment"
"https://xxx.atlassian.net/rest/api/3/issue/$TICKET_NAME/comment"
"https://xxx.atlassian.net/rest/api/3/issue/\"$TICKET_NAME\"/comment"
"https://xxx.atlassian.net/rest/api/3/issue/"$TICKET_NAME"/comment"
But nothing seems to work
This work inm my BASH
- >-
curl --location --request POST "https://adasiaholdings.atlassian.net/rest/api/3/issue/$TICKET_NAME/comment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $JIRA_API_TOKEN" \
-H "Cookie: atlassian.xsrf.token=$JIRA_COOKIE_TOKEN" \
--data-raw "{ \"body\": {\"type\": \"doc\",\"version\": 1,\"content\": [{\"type\": \"paragraph\",\"content\": [{\"text\": \""$PREVIEW_LINK"\",\"type\": \"text\"}]}]}}"
but return
> curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) nested brace in URL position 11:
{ "body": {"type": "doc","version": 1,"content": [{"type": "paragraph","content": [{"text": "","type": "text"}]}]}}
in the pipeline
Hi @federico,
Please use ${TICKET_NAME}, ${PREVIEW_LINK}, ${JIRA_COOKIE_TOKEN} and ${JIRA_API_TOKEN}
The ${TICKET_NAME} in the URL shouldn't be within quotes.
Below is a curl command (with a few different variables) that works for me in Pipelines:
- curl -v --request POST --url "https://XXXX.atlassian.net/rest/api/3/issue/${issueKey}/comment" --user "${JiraEmail}:${JiraToken}" --header 'Accept:application/json' --header 'Content-Type:application/json' --data-raw "{\"body\":{\"type\":\"doc\",\"version\":1,\"content\":[{\"type\":\"paragraph\",\"content\":[{\"text\":\""${PREVIEW_LINK}"\",\"type\":\"text\"}]}]}}"
Please feel free to let me know if that works for you or if you're still seeing errors.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.