Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

datadog send event

Zuberu Abdulraman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 19, 2020

Hi,

I need some guide implementing the bitbucket data send event. From the documentation it should be added to the script part, but I have few questions. From the implementation these are the properties:

ITLE: '<string>'
    # TEXT: '<string>' # Optional.
    # PRIORITY: '<string>' # Optional.
    # ALERT_TYPE: '<string>' # Optional.
    # TAGS: '<string>' # Optional.
    # DEBUG: '<boolean>' # Optional.
    # EU_ENDPOINT: '<boolean>' # Optional.

 

So how can datadog notify if a build fails? 

1 answer

1 accepted

0 votes
Answer accepted
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2020

Hi @Zuberu Abdulraman ,

Thank you for your question!

You can use $BITBUCKET_EXIT_CODE variable in the after-script section.
$BITBUCKET_EXIT_CODE - the exit code of a step, if step success value setup to 0.

script:
- <some build logic>
after-script:
- ALERT_TYPE="success"
- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="error" ; fi
- pipe: atlassian/datadog-send-event:1.1.2
variables:
API_KEY: $API_KEY
ALERT_TYPE: $ALERT_TYPE

 

Cheers,
Alex 

Zuberu Abdulraman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2020 edited

 

Hi Alex,

Thanks for the information. I really appreciate that :) One more thing about TAGS, I was trying to use the ALERT TYPE as TAG but I was not successful. How can that be done?

 

So that incase its failure or success the alert will have tags.e.g of alert will be:

This is the title #status:error/success #branch:master #repository:aws #workspace:xxxxx%%% \n Alert sent from [Pipeline #60](https://bitbucket.org/xxxåxxxx/aws/addon/pipelines/home#!/results/60) \n %%%

Zuberu Abdulrahman May 28, 2020

Got this working with tags by defining 2 tags as variables. error and success. So that when failure the tag will be added to the log sent as tag.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events