14 Jan 2019
10:00 PM
- last edited on
10 Dec 2021
01: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.
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
Yes, there is no status field in payload. There should be a status field. But I am not sure what the syntax is.
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
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
Thanks, Sebastian. I will check this.
Did you try to specify the tag as 'Contextless' in an array. See my example here.