15 Jan 2019 06:00 AM - last edited on 10 Dec 2021 09:32 AM by MaciejNeumann
We are posting the jenkins deployment job JSON to SaaS. We tried to make the build fail. But It seems the event reported is not showing the build failure. How can we post the status of build failure?
Below is JSON being posted:
I am not jenkins expert, can you please help?
Solved! Go to Solution.
15 Jan 2019 08:19 AM
This payload doesn't contain any variable that shows build status. I'm not familiar with jenkins but first thing first. Does exist any variable in jenkins that has this information?
Sebastian
15 Jan 2019 08:22 AM
Yes, there is no status field in payload. There should be a status field. But I am not sure what the syntax is.
15 Jan 2019 08:26 AM
Here you have full syntax for EVENTS API:
https://www.dynatrace.com/support/help/shortlink/api-events#post-events
You have description and customProperties fields, maybe in one of them you will be able to add this information. Those $(BUILD_ID) are env variables from jenkins. So you will have to find out the one that is responsible for build status and put it as value to one of fields I proposed to you.
Sebastian
15 Jan 2019 08:32 AM
Sorry my bad:
https://www.dynatrace.com/support/help/shortlink/api-events#parameters-mapping-
Here is list of allowed fields in custom deployment. Maybe adding in deployment name status into brackets is solution for it... You have to play with this I think.
The variable from jenkins you need is $(BUILD_STATUS).
so maybe
"deploymentName":"$(JOB_NAME) ($(BUILD_STATUS))"
Sebastian
15 Jan 2019 08:54 AM
Thanks, Sebastian. I will check this.
15 Jan 2019 08:26 AM
Did you try to specify the tag as 'Contextless' in an array. See my example here.