Hi,
I have a Bitbucket pipeline which internally calls different APIs for authentication and other functionalities. I want to get notification for all the pipeline failures. But if the failure log contains specific error message or error code, I would like send a notification to other teams as well. These team may change base based on the error code/message.
Is there a way to achieve this scenario in Bitbucket pipeline.
Good question!
Also, 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
with pipes for notification, alerting, monitoring
atlassian/datadog-send-event
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
or atlassian/email-notify
build: &build
step:
name: Build
script:
- echo "Starting build..."
#- <your build logic>
after-script:
- ALERT_TYPE="success"
- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="error" ; fi
- pipe: atlassian/email-notify:0.3.12
variables:
USERNAME: 'myemail@example.com'
PASSWORD: $PASSWORD
FROM: 'myemail@example.com'
TO: 'example1@example.com, example2@example.com'
HOST: 'smtp.gmail.com'
SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}'
To discover more pipes, visit Bitbucket Pipes Marketplace.
Best regards,
Oleksandr Kyrdan
G'Day!
Currently, we don't have the feature to create a custom email notification for specific error messages in Bitbucket pipeline build logs.
We only sent email notification for failed build at this moment, but I have proceeded to raise a feature request on behalf of you, please Vote and Watch the feature request so that you'll receive an update whenever we have any at:
I hope this helps.
Cheers,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Syahrul Hello Folks, Is this issue fixed?
What I'm looking for in the pipeline? I'm running a set of Terraform commands in the bit bucket pipeline, Which will kick off commands one after another:
Terraform init
Terraform validate
Terraform plan
Which i followed link on internet:
1. @o_kyrdan Is this worked?
https://community.atlassian.com/t5/Bitbucket-questions/Send-notification-if-build-failure-log-contains-specific-error/qaq-p/1878124
2. @Syahrul Will this works?
https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-Pipelines-amp-approvals/qaq-p/1659160
i. https://bitbucket.org/blog/a-modern-approach-to-change-management-with- bitbucket-and-jira-service-management
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.