Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laaraujo/cloud-build-slack-notifications
Automated Slack notifications for GCP Cloud Build
https://github.com/laaraujo/cloud-build-slack-notifications
cloud-build gcp infrastructure-as-code notifications slack terraform
Last synced: about 1 month ago
JSON representation
Automated Slack notifications for GCP Cloud Build
- Host: GitHub
- URL: https://github.com/laaraujo/cloud-build-slack-notifications
- Owner: laaraujo
- License: mit
- Created: 2024-04-19T22:44:55.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-14T18:57:56.000Z (4 months ago)
- Last Synced: 2024-11-08T10:12:43.460Z (3 months ago)
- Topics: cloud-build, gcp, infrastructure-as-code, notifications, slack, terraform
- Language: HCL
- Homepage: https://laaraujo.github.io/cloud-build-slack-notifications/
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![tfsec](https://github.com/laaraujo/cloud-build-slack-notifications/actions/workflows/tfsec.yml/badge.svg?branch=main)](https://github.com/laaraujo/cloud-build-slack-notifications/actions/workflows/tfsec.yml)
# Cloud Build Slack notifications
Get slack notifications whenever there's a Cloud Build status update.
## Table of contents
* [Pre-requisites](#pre-requisites)
* [Installation](#installation)
* [Configuration](#configuration)
* [Manual Deployment](#manual-deployment)
* [Sources](#sources)## Pre-requisites
1. [Slack App](https://api.slack.com/apps)
2. [Webhook URL](https://api.slack.com/messaging/webhooks) for the app above## Installation
1. Clone this repository
```sh
git clone [email protected]:laaraujo/cloud-build-slack-notifications.git
```2. Change directory to the terraform folder
```sh
cd terraform
```3. Install Terraform providers and dependencies
```sh
terraform init
```## Configuration
### [For manual deployment](#manual-deployment)
Sample `terraform.tfvars`:
```sh
project_id = ""
region = ""
zone = ""
slack_app_webhook_url = ""
```### [config.yml](./files/config.yml)
Config file for the slack notifier image. Let's the actual service know where to look for the template and what kind of notifications to send* Reference: [GCP Cloud Build API](https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds)
### [template.json](./files/template.json)
Template for the message received in Slack.
This repository includes the default one but it can be customized.> ![resulting notifications](./docs/slack_notifications.png)
> Result notification from Cloud Build `Run Sample Build` option* Reference: [Slack API Block Kit](https://api.slack.com/block-kit)
## Manual deployment
These instructions assume you already have:
* [Terraform](https://www.terraform.io/) installed
* [GCP Credentials configured locally](https://cloud.google.com/docs/authentication/provide-credentials-adc)1. Check what `terraform plan` looks like:
```sh
terraform plan
```2. If the output above looks good, go ahead and apply those changes (you will be prompted to confirm with **"yes"**):
```sh
terraform apply
```## Sources
* [Configuring Slack Notifications](https://cloud.google.com/build/docs/configuring-notifications/configure-slack)
* [GCP Cloud Build API](https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds) for customizing notifier behavior in [config.yml](./files/config.yml)
* [Slack API Block Kit](https://api.slack.com/block-kit) for customizing slack message in [template.json](./files/template.json)
* [Cloud Build Slack Notifier docker image](https://github.com/GoogleCloudPlatform/cloud-build-notifiers/tree/master/slack)## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.