I'm working on a Bamboo plan that interacts with a Service Desk ticket. The idea is that Bamboo does some long-running work and then updates the ticket with the results.
The bit I'm trying to figure out at the moment is how to update the SD ticket if something goes wrong with the Bamboo build. I've added a script to the plan under the "Final tasks" section with the intention that the script would query Bamboo to find out the status of the running build and, if something has gone wrong, update the SD ticket with that information.
I'm querying /rest/api/latest/result/<plan key>/<build number> and getting the data back from Bamboo but "state" and "buildState" are both set to "Unknown".
I could implement a solution by creating a marker file at the start of the plan and deleting it after a successful run of the long-running script then have the "final task" script check for the existence of the marker file but it seems a bit inelegant.
Is there any method for me to retrieve the information I'm looking for?