Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

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

- 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.
@google-labs-jules
Copy link
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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.

# 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.
Copy link
Owner

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

Copy link
Contributor Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant