This repo provides deployable notifier images and sources, as well as libraries for creating new notifiers.
Cloud Build notifiers are Docker containers that connect to the Cloud Build Pub/Sub topic that adapt Pub/Sub messages about Build update notifications to other services/protocols, such as SMTP for email. Cloud Build notifiers are long-lived binaries that receive notifications throughout Builds' lifecycles (e.g. from the Build starting to execute through the Build finishing).
All notifiers can be built by Cloud Build and deployed on Cloud Run. The only prerequisite is to be a Cloud Build user and to have the gcloud CLI tool installed and configured for your Cloud Build project(s).
There are currently 4 supported notifier types:
bigquery
, which writes Build updates and related data to a BigQuery table.http
, which sends (HTTPPOST
s) a JSON payload to another HTTP endpoint.slack
, which uses a Slack webhook to post a message in a Slack channel.smtp
, which sends emails via an SMTP server.
See the official documentation on Google Cloud for how to configure each notifier:
- Configuring BigQuery notifications
- Configuring HTTP notifications
- Configuring Slack notifications
- Configuring SMTP notifications
A setup script exists that should automate most of the notifier setup.
Run ./setup.sh --help
for usage instructions.
The following are flags that belong to every notifier via inclusion of the lib/notifiers
library.
This flag starts up the notifier image but only logs the notifier name (via type) and then exits.
This flag starts up the notifier, which does the following:
- Read the notifier configuration YAML from STDIN.
- Decode it into a configuration object.
- Attempt to call
notifier.SetUp
on the given notifier using the configuration and a faked-outSecretGetter
. - Exit successfully unless one of the previous steps failed.
This can be done using the following commands:
# First build the notifier locally.
$ sudo docker build . \
-f=./${NOTIFIER_TYPE}/Dockerfile --tag=${NOTIFIER_TYPE}-test
# Then run the `setup_check` with your YAML.
# --interactive to allow reading from STDIN.
# --rm to clean/remove the image once it exits.
$ sudo docker run \
--interactive \
--rm \
--name=${NOTIFIER_TYPE}-test \
${NOTIFIER_TYPE}-test:latest --setup_check --alsologtostderr -v=5 \
< path/to/my/config.yaml
This project uses an Apache 2.0 license.
See here for contributing guidelines.
There are several ways to get support for issues in this project:
Note: Issues filed in this repo are not guaranteed to be addressed. We recommend filing issues via the Issue Tracker.