cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to post the deployment job status from Jenkins via Event API?

rswarnka
Helper

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?

 

6 REPLIES 6

skrystosik
DynaMight Guru
DynaMight Guru

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


Regards, 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


Regards, 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


Regards, Sebastian

Thanks, Sebastian. I will check this.


wolfgang_beer
Dynatrace Leader
Dynatrace Leader

Did you try to specify the tag as 'Contextless' in an array. See my example here.


Featured Posts