Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: extract python library, write a notifier that uses it #3

Merged
merged 11 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added more readme detail
  • Loading branch information
brandonjbjelland committed Feb 1, 2023
commit e6958e08f5199a98e7943ebf07d5ba36fa4db3ab
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.1.0] - Jan 31, 2022

### Added

- Everything. This is the initial repo contents.
- Created 2 new notifiers: `echo-fastapi` demonstrates the basics of how to build a notifier using fastapi. `release-auto-promoter` advances releases by creating rollouts for the next target in a release pipeline when the previous succeeded.
- Extracted a python library to simplify the process of building a notifier.
- Created a terraform module (`terraform/cloud-deploy-notification-infra`) for the notification infrastructure needing to be instantiated once on a project that hosts notifiers.
- Created a terraform module (`terraform/cloud-deploy-notifier`) that can manage all infra components of a typical notifier. Both `echo-fastapi` and `release-auto-promoter` though having slightly different infra requirements, are able to use this module to create all necessary resources.
- The `/demo` directory packs both an example application (`nginx-app`) with its release pipeline IaC and a set of configurations in a `terragrunt` directory. The `terragrunt.hcl` configurations wire together and call the various terraform modules thorughout this repo, showing how all the components relate and can be deployed as separate units.
- `data-samples/` provides 3 example PubSub message payloads so devs can quickly understand the payloads we're working with.
- `.devcontainer` provides configurations for developing this project within a reproducable containerized environment.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,28 @@ to manage all dependent infra.
In either case, including an example of the variable inputs in an `example.tfvars`
file is a simple way to guide notifier consumers on how to run this terraform.

## Notifier configuration per pipeline

The way notifiers are configured for usage by workload deploy pipelines differs
to the cloud-build repos. Following a kubernetes-style configuration approach,
once a deploy notifier is deployed, it can operate against notifications
originating from any Cloud Deploy pipeline but until a deploy pipeline opts-in,
a notifier should do nothing.

A workload's deploy pipeline opts-in to using a given notifier via an annotation
on the pipeline (and potentially annotations on targets). The annotation value
should point to a secret in secret manager that the notifier can use for
configuration values during an invocation. This pattern allows any number of
notifiers to be deployed and available to workload pipelines while giving
pipeline owners a simple mechanism to enable and configure a custom set of
notifiers on their pipelines.
## Per Pipeline notifier configuration

Once deployed, notifiers are configured via workload deploy pipelines that opt-in
to using them. Following a kubernetes-style configuration approach, each notifier
has a distinct configuration annotation key that Cloud Deploy Pipelines must
include if they want to leverage a notifier.

The annotation value should point to a user-configured secret in Secret Manager.
This secret should contain configuration values that the notifier unpacks during
an execution. This is a powerful pattern for a few reasons:

1. It's secure - some notifiers will require secret data, others won't necessarily, but it's not a bad practice to treat all configuration as sensitive and RBAC controlled.
2. Notifiers can be liberally deployed without affecting existing deploy pipelines - enabling a notifier requires an annotation on opting-in deployment pipelines and the configuration in secret manager.

## Deploy notifier index

* [echo-fastapi](notifiers/echo-fastapi/) - an example deploy notifier in Python
that echos the payload.
* echo-go - an example deploy notifier in go.
* [echo-fastapi](notifiers/echo-fastapi/) is an example deploy notifier in Python
that echos the payload, the configuration secret contents, and kwargs.
* [release-auto-promoter](notifiers/release-auto-promoter/) is a notifier that
promotes releases as rollouts in deploy pipeline succeed. This reduces a manual
task from release managers or engineers who just want successful deployments to
be promoted to higher envs.

## Development

Expand All @@ -77,7 +78,7 @@ an environment variable which many/most/maybe all Google Cloud SDKs support:
export GOOGLE_OAUTH_ACCESS_TOKEN=$(gcloud auth print-access-token)
```

## What's forthcoming?
## What's upcoming?

1. Build out a demo that operates against a pipeline targeting a GKE workload
2. create an example notifier in go
Expand Down