It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pre-Post Build Command Runner run issue

Matt Luebbering Apr 28, 2017

Running Bamboo 5.15.3 and just got Pre-Post Build Command runner installed and trying to use it to create a jira bug upon failed buid. Bamboo is on a windows server and wanting to execute the command on the server, not a remote. Running the following command

"C:\Program Files\CustomMEM\Executables\curl" -D- -u username:password -X POST -d "{\"fields\": {\"project\": {\"key\": \"MATH\"}, \"summary\": \"${bamboo.buildPlanName} - Build: ${bamboo.buildNumber} Change List: ${bamboo.repository.revision.number}\", \"description\": \"Link to the failed build: ${bamboo.buildResultsUrl}\", \"issuetype\": {\"name\": \"Bug\"}}}" -H "Content-Type: application/json" https://<jiraServer>/rest/api/2/issue/

 

When I run the build it bombs out with 

curl: (6) Could not resolve host: "summary"
28-Apr-2017 10:17:57 curl: (3) Port number ended with ' '
28-Apr-2017 10:17:57 curl: (6) Could not resolve host: "description"
28-Apr-2017 10:17:57 curl: (3) Port number ended with ' '
28-Apr-2017 10:17:57 curl: (6) Could not resolve host: "issuetype"
28-Apr-2017 10:17:57 curl: (3) [globbing] unmatched brace in column 1
28-Apr-2017 10:17:57 curl: (3) [globbing] unmatched close brace/bracket in column 6

So I took the command that was generated after Bamboo subsititued the variables and ran it on command line and it worked perfectly. 

Any and all help would be appreciated and thanks in advance!

1 answer

0 votes
Elias Zeidan Atlassian Team Aug 16, 2017

Hi Matt!

Thanks for your Question. It looks like the issue here is that the quotes inside the data (eg: \"fields\") are not being properly escaped for the Script task. 

Could you please try the following:

  • Use two backslashes instead of one so that the backslash is escaped when the code is read by Bamboo and then the double quote is escaped when sent to curl
    "C:\Program Files\CustomMEM\Executables\curl" -D- -u username:password -X POST -d "{\\\"fields\\\": {\\\"project\\\": {\\\"key\\\": \\\"MATH\\\"}, \\\"summary\\\": \\\"${bamboo.buildPlanName} - Build: ${bamboo.buildNumber} Change List: ${bamboo.repository.revision.number}\\\", \\\"description\\\": \\\"Link to the failed build: ${bamboo.buildResultsUrl}\\\", \\\"issuetype\\\": {\\\"name\\\": \\\"Bug\\\"}}}" -H "Content-Type: application/json" https://<jiraServer>/rest/api/2/issue/
  • Enclose the data in single quotes:
    "C:\Program Files\CustomMEM\Executables\curl" -D- -u username:password -X POST -d '{\"fields\": {\"project\": {\"key\": \"MATH\"}, \"summary\": \"${bamboo.buildPlanName} - Build: ${bamboo.buildNumber} Change List: ${bamboo.repository.revision.number}\", \"description\": \"Link to the failed build: ${bamboo.buildResultsUrl}\", \"issuetype\": {\"name\": \"Bug\"}}}' -H "Content-Type: application/json" https://<jiraServer>/rest/api/2/issue/

Thanks!

Elias 
Bamboo Support

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar alert! An IT Admin's Guide to Securing Collaboration at Scale

Hello, Atlassian Community! My name is Dave Meyer and I'm a Principal Product Manager at Atlassian. I wanted to give this community a heads up about an upcoming Webinar that might be of interest...

186 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you