Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
assets
examples Fix merge conflict Dec 11, 2018
slackbot Add slackbot Dec 11, 2018
Dockerfile
README.md Add slackbot Dec 11, 2018
cloudbuild.yaml Adds 'tags: [cloud-builders-community]' to all builders (#261) Jul 10, 2019
main.go Fix merge conflict Dec 11, 2018

README.md

slackbot

Slackbot allows you to post build status messages to Slack.

Slack screenshot

Getting started

If you are new to Google Cloud Build, we recommend you start by visiting the manage resources page in the Cloud Console, enable billing, enable the Cloud Build API, and install the Cloud SDK.

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

Examples showing both successful and unsuccessful builds are in the examples directory.

Customization

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.

You can’t perform that action at this time.