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