Currently, receiving slack notifications about build events is managed at the org-level and configured per pipeline, without support for filtering by the user that triggered the build. I’d like to be able to individually subscribe to receive slack notifications that are sent to me as DM’s, and only be notified about my builds.
The reason the pipeline-level filters don’t work for me is that our team contributes to many repos with their own pipelines, and these repos are shared by many teams beyond my own. If I subscribe to every build event in every pipeline that I sometimes use, I would be drowning in notifications. It’d be amazing if I could subscribe to anything I do anywhere, and a cherry on top would be to also filter down by branch name. Our prod deploys happen only in main/master branches, so I’d like to be able to target those specifically.
Use cases:
Find out when my build failed
Find out when my build is blocked and ready for approval
The second one in particular is important to me because our builds trigger when code merges to main in GitHub, and often I forget that Buildkite does this automatically. I’d like the reminder that I need to manually approve it to deploy to production, otherwise it sits there forgotten, which delays our team’s production lead time metrics and can create coordination confusion with other people that have code to deploy to prod but aren’t sure if my change is ready to go.
You can have more control over when each channel receives notifications with the notify attribute
Before adding a notify attribute to your pipeline.yml , ensure an organization admin has set up a Slack integration for the channel or user that you want to post to. For detailed information about setting up a Notification Service, see the Slack integration page.
Particularly speaking about the build.state, the state of the overall build is not available when executing a job. If a job is executing, the state of the build can’t be failed or passed as well, because there’s still a job executing.
It’s not possible to evaluate build.state without using an API to fetch the build and look at the states of the finished jobs. If you’re within a job running within the build then the build is still running, too.
Hi Paula, thanks for your response. The suggestions you provided won’t quite work for what I’m looking for, I’d like Buildkite to allow individuals to personally subscribe to any pipelines triggered by them, without having to hardcode themselves into the buildkite.yaml file for each pipeline.
If you’re aiming to subscribe to pipelines for an individual user, you can set up an individual notification service and use the filters to choose the required pipeline and states.
Good news is that we recently introduced an improved Slack Workspace notification service, which should cover the use case you’re looking at here! This one works by connecting to a single slack workspace once, and allows for more flexible notifications (including the pattern you are trying to do here).
Have you already had a look at that one? If not, I would suggest giving it a try and see if it covers your use case!
Hey @jonathanyeong that’s correct - we’ve made improvements to our Slack integration through this integration to allow for more flexibility with sending notifications from your pipelines.
Hey Jeremy, thanks for the reply. I was able to enable the updated integration. In the docs, it’s mentioned that the build creator would be mentioned
# Build creator mentions
Build creators will be mentioned in notifications if the email address associated with their Slack account is attached to their Buildkite account.
But in the notification docs it only shows how to notify someone by providing username or user id.
You can notify a user in all workspaces configured through your Slack or Slack Workspace notification services by providing their username or user ID, respectively, in the pipeline.yml.
I was wondering if we can notify a user dynamically, based on who created the build. Like
Hi @jeremy — just revisiting this. I was able to set up the new Slack Workspace notification service, but there appears to be one missing piece, which is to be able to notify the build creator via a Slack private message of a build success or failure.
Once Buildkite is connected to Slack at an organizational level as part of the new Slack Workspace integration, my assumption was that it’d be able to do this mapping for us.
Hey @bhamilton - at the moment we aren’t able to so because we don’t maintain a list of creator emails and Slack IDs that can be used to target a DM. You would need to use that plugin or create your own method of maintaining that list of IDs to specify the user’s Slack ID in the channel.
It’s good feedback though - and I’ll share it with the team, but I don’t know if or when we would add that capability.
Thanks @jeremy. I’m used to the GitHub Slack bot, which kindly notifies me on Slack whenever a GitHub Actions which was triggered by my user starts, and when it fails.
We’ve had a lot of success transitioning off GitHub Actions and onto Buildkite, but the lack of Slack integration for personal Buildkite pipeline notifications was very surprising to me.
In case it helps, here’s the Slack API to get a user by email address. The new Slack Workspace integration ought to be able to use this to look up the user’s Slack ID in the user.id field in the response.