Git Product home page Git Product logo

google-cloud-build-slack's Introduction

google-cloud-build-slack

Slack integration for Google Cloud Build, using Google Cloud Functions to post messages to Slack when a build reaches a specific state.

Setup

  • Create a Slack app, and copy the webhook URL:
export SLACK_WEBHOOK_URL=my-slack-webhook-url
  • Set the PROJECT_ID variable:
export PROJECT_ID=my-project-id
  • [Optionally] Set a specific BUCKET_NAME and a FUNCTION_NAME.
  • [Optionally] Set the status you want a message for, here are the default ones:
export GC_SLACK_STATUS="SUCCESS FAILURE TIMEOUT INTERNAL_ERROR"
  • Create the function:
. ./setup.sh
# OR
npm run setup

Teardown

The teardown script will delete the function FUNCTION_NAME, and the bucket BUCKET_NAME.

. ./teardown.sh
# OR
npm run teardown

FAQ

How much does it cost?

Each build invokes 3 times the function:

  • when the build is queued
  • when the build starts
  • when the build reaches a final status.

Here is the GCF pricing for calculation.

Can I use an existing bucket?

Yes, specify the BUCKET_NAME:

exports BUCKET_NAME=my-bucket

How can I update a function?

If you use the setup script with the same FUNCTION_NAME, it will update the existing function.

Where can I find the SLACK_WEBHOOK_URL?

After creating an application on Slack, active the Incoming Webhooks. You'll find the url on that page: slack webhook

Why do I have to source the script?

In the case where a BUCKET_NAME is not defined, a random one is generated. And in order to delete it during the teardown, the variable has to be exported from the setup script.

google-cloud-build-slack's People

Contributors

bendory avatar imjasonh avatar naseemkullah avatar philmod avatar plutov avatar rimusz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.