hosting-cli(gcp): add --cpu, --memory, --min-instances flags#6552
Conversation
Forward the new CPU / MEMORY / MIN_INSTANCES env vars to the deploy script so users can override the Cloud Run resource allocation. The restricted env in `_run_deploy_script` means callers couldn't override these from their shell — they have to come through the CLI flags. Defaults match the previously hard-coded values (1 / 1Gi / 1). Requires the matching backend change in flexgen (reflex-dev/flexgen#3735) so the deploy script honors the new env vars. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR adds
Confidence Score: 4/5Safe to merge; the new flags follow existing patterns and defaults preserve current behavior, with the only risk being invalid user input surfacing later inside gcloud rather than at the CLI. The implementation is straightforward and correct. The only concerns are that The Important Files Changed
Reviews (1): Last reviewed commit: "hosting-cli(gcp): add --cpu, --memory, -..." | Re-trigger Greptile |
Per Greptile review on #6552: - Rename CPU / MEMORY / MIN_INSTANCES env vars to CLOUD_RUN_CPU / CLOUD_RUN_MEMORY / CLOUD_RUN_MIN_INSTANCES to avoid ambient shell-var shadowing (the bash `:=` expansion in the deploy script would pick up any ambient value with these short names). The flexgen-side script was renamed in the companion PR. - Validate --min-instances at the CLI via `click.IntRange(min=0)` so garbage input fails fast with a helpful error instead of bubbling up as an opaque gcloud error. Skipping format validation on --cpu and --memory: the set of valid Cloud Run values varies by execution-environment generation, so a client-side regex risks rejecting valid input. Let gcloud be the authority on what it accepts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
--cpu,--memory, and--min-instancesflags toreflex deploy --gcp. They forward to the deploy script viaCPU,MEMORY, andMIN_INSTANCESenv vars._run_deploy_script(allowlist-only) means callers couldn't override these from their shell — they have to come through CLI flags.1/1Gi/1), so the no-args behavior is unchanged.Test plan
pytest tests/units/reflex_cli/v2/test_gcp.py(22 passed locally, includes 2 new tests covering custom values and defaults)--cpu 2 --memory 2Gi --min-instances 0once the flexgen PR is merged, and confirm the renderedgcloud run deployline uses them.🤖 Generated with Claude Code