Buildkite has a notifications feature that can notify channels in slack about build status. The problem is that it's missing a mapping to the build creator's slack ID.
This plugin uses the notifications feature and a mapping file to @at the creator of a failed build.
Add the following to your pipeline.yml
:
steps:
- label: ":slack: Notify on fail"
if: build.branch == "main"
plugins:
- envato/build-failed-notify-slack#v1.1.0:
mapping_file: slack_users.json
channel: "#my-channel"
Mapping files can be downloaded from s3
steps:
- label: ":slack: Notify on fail"
if: build.branch == "main"
plugins:
- cultureamp/aws-assume-role#v0.2.0:
role: "arn:aws:iam::123456789012:role/example-role"
- envato/build-failed-notify-slack#v1.1.0:
mapping_file: s3://my-bucket/slack_users.json
channel: "#my-channel"
JSON file with an array of users slack id's and email addresses (email used in Buildkite, appears as BUILDKITE_BUILD_CREATOR_EMAIL
)
eg.
[
{
"email": "[email protected]",
"slackId": "U1234"
},
{
"email": "[email protected]",
"slackId": "U5678"
}
]
Including the hash, a channel in slack.
Note
The slack channel must be configured to receive notifications with the Buildkite Builds Slack app. More support for integrating with Buildkite can be found in their documentation
To run the tests:
docker-compose run --rm tests
To run the linting:
docker-compose run --rm lint