GoogleChrome / GoogleChrome/webstatus.dev

[ENHANCEMENT] Use GCP Cloud Deploy to automate deployments

Open
#648 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
254
Forks
62
Avg merge
1d 10h
Merged PRs (30d)
64

Description

**Is your feature request related to a problem? Please describe.**
Currently, project maintainers have to manually deploy the project to both staging and production

**Describe the solution you'd like**
GCP provides a relatively new solution called [Cloud Deploy](https://cloud.google.com/deploy?hl=en). Cloud Deploy depends on a project using Skaffold, which we already use, to know which resources to deploy. It works with Cloud Run targets out of the box. Additionally, Cloud Deploy supports Custom Targets. This will be useful for the terraform code that should run first. They have [examples](https://cloud.google.com/deploy/docs/custom-targets#custom_target_examples) of using terraform in a custom target too.

Additionally, if we ever need to do a rollback, there is a [UI](https://cloud.google.com/deploy/docs/roll-back#console) for that.

It gives us the ability to automatically or manually promote releases between environments
![image](https://github.com/user-attachments/assets/1dec114c-0aa4-4de6-aa49-157d99d1613b)

Since this uses Skaffold, we can enable the `gitCommit` [tagPolicy](https://skaffold.dev/docs/taggers/) to automatically tag our deployments with the git commit sha too.

Here's a first draft of the steps needed to complete this card

- [ ] Create a new deployer GCP project. Or maybe call it an admin project so that it can do more things in the future.
- [ ] Create two new profiles in the existing Skaffold configs called `staging` and `prod`. This config should only deploy the services and jobs and not things like the database emulator (which happens in the existing `local` skaffold profile).
- [ ] For each service and job, follow the instructions in this [section](https://cloud.google.com/deploy/docs/deploy-app-run#prepare_your_services_or_jobs).
- [ ] Remove the deployment of the cloud run services and jobs from terraform
- [ ] Update the instructions on how users can deploy their own version still (this may need to be split out to a separate card with a lower priority)

A few downsides that I saw initially with this:
- We will need to create a lot of service.yaml / job.yaml files (one per app per region per project)
- We currently configure environment variables dynamically from output from terraform. We would need to hard code these values in the service.yaml / job.yaml files
- We still need a way to build the images before running the pipeline according to this [doc](https://cloud.google.com/deploy/docs/deploying-application#invoke_your_delivery_pipeline_to_create_a_release)
- We still need a way to create the release (could have developers run gcloud deploy releases create)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.