You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I'm looking at replacing one of our jenkins pipelines with bitbucket. Currently, we have nightly builds, however these require someone to go and manually check whether they've been successful.
I would like the new scheduled pipeline to do a nightly build, but only trigger an alert into a slack channel if it fails. Is this possible?
The Slack integration does not cover your specific case, so a solution does involve a slightly higher overhead, however curl and a slack bearer token should do it:
After Script Example (Docs / Announcement Jan 2019)
image: node:10.15.0
pipelines:
custom: # Pipelines that are triggered manually
sonar: # The name that is displayed in the list in the Bitbucket Cloud GUI
- step:
script:
- echo "Manual triggers for Sonar are awesome!"
after-script:
- test $BITBUCKET_EXIT_CODE -ne 0 && curl ...
For larger command lines I often find YAML multiline strings useful for better readability.
Curl Example (from Slack docs)
curl -X POST -H 'Authorization: Bearer xoxb-1234-56789abcdefghijklmnop' \
-H 'Content-type: application/json' \
--data '{"channel":"C061EG9SL","text":"I hope the tour went well, Mr. Wonka.","attachments": [{"text":"Who wins the lifetime supply of chocolate?","fallback":"You could be telling the computer exactly what it can do with a lifetime supply of chocolate.","color":"#3AA3E3","attachment_type":"default","callback_id":"select_simple_1234","actions":[{"name":"winners_list","text":"Who should win?","type":"select","data_source":"users"}]}]}' \
https://slack.com/api/chat.postMessage
/Edit: There is a similar question regarding doing this, not with slack but email notifications which looks like another good reference:
You can also set the chat notifications for your repository after you integrate bitbucket into a slack channel. This works great, and I get a pass/fail notice after every pipeline run in my slack channel.
Check out https://confluence.atlassian.com/bitbucket/notifications-for-bitbucket-pipelines-857053284.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But how to set this up especially for custom pipelines only (here: that have been triggered by the scheduler)? I didn't find that option and the original poster (OP) asked for that. Maybe you know more?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Open the repository
Open Repository Settings
Open Chat Notifications
- if you don't already have a subscription configured, then you need to do that first
Configure the notifications you want, like "pipeline failed"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@chare Yes that dialog, unfortunately there is no differentiation between the type of a pipeline possible, e.g. only failed custom pipelines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes - that is true. does it not work for scheduled pipelines? We don't use those, so I don't have any experience with them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think it does work, it's just then it's for all failed Pipelines which might be too much for specific messaging.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if it doesn't overload the messaging system, it might get annoying for the recipients ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.