Coder Social home page Coder Social logo

thealekhnovich / again-n-again Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 36 KB

Edit of cloud-build-notifications repository in order to make it usible again.

Dockerfile 1.76% TypeScript 90.91% JavaScript 7.33%
gcb gcr html typescript email-notifications google-cloud-platform google-cloud-build google-cloud-run

again-n-again's Introduction

Google Cloud Build SMTP notifier EDITED

Changes:

  • Removed parts related to notifications in Google Chat Room.
  • Updated dependencies to latest versions as of March 2023.
  • Updated version of Node base image in Dockerfile to 19.
  • Wrote a cloudbuild.yaml file to make it possible to deploy notifier's service via GCB.

How it works:

When a build starts in GCB, Pub/Sub generates a notification for EventARC, what then triggers the notification service on Google Cloud Run. The process in GCR collects information about running building process and then send an email to recipents in the list. By default, the notifier can send theree email-notifications: regarding started building process, one in case of success and another in case of failure.

How to apply to your project on Google Cloud Platform:

  1. Add roles Cloud Build Editor, Cloud Build Service Account, Cloud Run Admin, Service Account User to accout PROJECT-ID@cloudbuild.gserviceaccount.com. And role Eventarc Admin to account PROJECT-ID[email protected].
  2. Create EventARC trigger
  3. Create Pub/Sub subscribtion
  4. Build the process in GCR, using provided files. You can both create an image, using provided Dockerfile, locally and upload it later to Artifact Registry or Container Registry, or deploy a service via GCB, using provided YAML file (remember to add project name, image name and to the YAML)_

Files

  • Configuration file with list of recipients, SMTP server and creds for it: .env
  • File with list of exports of filenames: /src/utils/constants.ts
  • File with filed what will be included in a email: /src/clients/Client.ts
  • File with body of a email: /src/clients/Mail/SMTPClient.ts

Issuses:

  • Since I'm not into TypeScript, I couldn't add possibility to retrieve username and password of SMTP-server via Secret Manager of GCP. Following documentation by Google describes how to do it: Secret Manager: Node.js Client. Yon use app password to minimize attack surface.
  • I can't say for sure how to customize email that will be send out. But still, email seems to has enough info regarding.
  • You can use BASH-script setup.sh from the original repository to ease installation process. If the script won't successfully setup notifier -- it is fine, since you will have ready-to-go trigger in EventARC, subscription in Pub/Sub and a service in GCR (you can just add your image to GCR from Registry and run it).

again-n-again's People

Contributors

thealekhnovich avatar

Watchers

 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.