-
Notifications
You must be signed in to change notification settings - Fork 0
Add Preview Environments CI/CD #8
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
base: master
Are you sure you want to change the base?
Add Preview Environments CI/CD #8
Conversation
- Create `.github/workflows/preview-env.yml` to deploy ephemeral backend and frontend services to Cloud Run on PR open/update. - Create `.github/workflows/cleanup-preview.yml` to delete services and images on PR close. - Update `README_GCP.md` with instructions for setting up required secrets (`GCP_PROJECT_ID`, `GCP_CREDENTIALS`) and warnings about shared Redis usage.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Refactor `terraform/` to use a `modules/app` structure for shared Cloud Run definitions. - Create `terraform/preview/` configuration to deploy ephemeral environments using existing shared infra (VPC/Redis). - Add `.github/workflows/preview-env.yml` to deploy previews via Terraform on PRs. - Add `.github/workflows/cleanup-preview.yml` to destroy previews on PR close. - Add `.github/workflows/deploy-prod.yml` to deploy production on version tags. - Update `README_GCP.md` with CI/CD setup instructions (Secrets, GCS Backend). - Add `moved` blocks to `terraform/cloud_run.tf` to prevent resource recreation during migration.
.github/workflows/deploy-prod.yml
Outdated
|
|
||
| # Note: We assume images are already built by the build-publish.yml workflow | ||
| # which triggers on tags as well. | ||
| # To be safe, we can either wait for that workflow, or just rebuild here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depend on the build action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've integrated the production deployment logic directly into the build-publish.yml workflow as a dependent job (deploy-prod). This ensures that the deployment only proceeds after the build-and-push job succeeds, and it reuses the images built in the first stage (syncing them from GHCR to GAR).
- Refactor `terraform/` to use a `modules/app` structure for shared Cloud Run definitions. - Create `terraform/preview/` configuration to deploy ephemeral environments using existing shared infra (VPC/Redis). - Add `.github/workflows/preview-env.yml` to deploy previews via Terraform on PRs. - Add `.github/workflows/cleanup-preview.yml` to destroy previews on PR close. - Update `.github/workflows/build-publish.yml` to include a `deploy-prod` job that syncs images to GAR and applies Terraform on version tags. - Update `README_GCP.md` with CI/CD setup instructions (Secrets, GCS Backend). - Add `moved` blocks to `terraform/cloud_run.tf` to prevent resource recreation during migration.
- Refactor `terraform/` to use a `modules/app` structure for shared Cloud Run definitions. - Create `terraform/preview/` configuration to deploy ephemeral environments using existing shared infra (VPC/Redis). - Add `.github/workflows/preview-env.yml` to deploy previews via Terraform on PRs. - Add `.github/workflows/cleanup-preview.yml` to destroy previews on PR close. - Update `.github/workflows/build-publish.yml` to include a `deploy-prod` job that syncs images to GAR and applies Terraform on version tags. - Update `README_GCP.md` with CI/CD setup instructions (Secrets, GCS Backend). - Add `moved` blocks to `terraform/cloud_run.tf` to prevent resource recreation during migration.
This PR introduces automated preview environments for Pull Requests.
When a PR is opened or updated, a GitHub Action workflow builds Docker images for the backend and frontend, and deploys them to Google Cloud Run.
The frontend is configured to communicate with the specific backend deployed for that PR.
A comment is posted on the PR with the URLs for the preview environment.
When the PR is closed, another workflow cleans up the Cloud Run services and Artifact Registry images.
Note: The preview environments share the same Redis instance as the main environment. This allows testing without spinning up new database infrastructure but requires care to avoid destructive operations on the shared database.
PR created automatically by Jules for task 10643206759322787148 started by @WeixuanZ