Slackbot allows you to post build status messages to Slack.
Clone this repository and build the builder:
gcloud builds submit . --config=cloudbuild.yaml
Follow instructions on the Slack website to create a bot for your workspace. Copy and paste the webhook URL, you'll need it in a moment. If you want a neat bot profile image, you can download and use the official Cloud Build solution icon. (Note Slack will ask you to resize it to 500 x 500 pixels first.)
Using this tool
Add the builder as the first step in your project's
cloudbuild.yaml: this triggers an independent "watcher" build which posts a status update whenever your main build completes - whether it's success or failure.
steps: - name: 'gcr.io/$PROJECT_ID/slackbot' args: [ '--build', '$BUILD_ID', '--webhook', '<Add your webhook URL here>' ] ...
Examples showing both successful and unsuccessful builds are in the examples directory.
You may wish to customize your build notifications and provide different information in the messages posted to Slack. To do this, edit the JSON payload in notify.go, following the Slack message formatting guidelines.