Home

Awesome

Google Cloud Function sending Cloud Build statuses to a Slack channel, written in TypeScript

Features:

Slack message Slack message

Deploy

Prerequisites:

Deployment:

SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR_TOKENS ./deploy.sh

This script will deploy cloud function gcbSubscribeSlack triggered by cloud-build PubSub topic.

Message content can be (optionally) defined by _SLACK_MESSAGE_TEMPLATE substitution in cloudbuild.yaml. Value should be a valid ejs template:

steps:

# ... build steps ...

substitutions:
  _SLACK_MESSAGE_TEMPLATE: '<%= emoji %> *https://<%= build.substitutions._OVERLAY %>.example.com* frontend build & deploy `<%= build.id %>` <%= build.status %>'

emoji corresponds to a build status, build is object containing build information, it's structure is defined here.

The default message template is <%= emoji %> `<%= build.id %>` <%= build.status %>