fix(cli): gate --sandbox-launcher behind gcloud beta run deploy - #6514
Open
abhiramArise wants to merge 1 commit into
Open
fix(cli): gate --sandbox-launcher behind gcloud beta run deploy#6514abhiramArise wants to merge 1 commit into
abhiramArise wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
adk deploy cloud_rununconditionally appends--sandbox-launcherto thegcloud run deploycommand it constructs. That flag is only valid on thebetarelease track (gcloud beta run deploy) — it is not recognized on the GA track. As a result, everyadk deploy cloud_runinvocation fails with:Solution:
Added an opt-in
--with_cloud_run_sandboxCLI flag onadk deploy cloud_run:--sandbox-launcherremoved entirely.gcloud beta run deploy ... --sandbox-launcher, correctly targeting the release track that actually supports the flag.This keeps the default (and most common) path working out of the box, while preserving sandbox support for users who explicitly want it.
Testing Plan###
Unit Tests:
Added
test_to_cloud_run_with_sandbox(parametrizedTrue/False) intest_cli_deploy_to_cloud_run.py, verifying:with_cloud_run_sandbox=False→ nobetainserted, no--sandbox-launcherin the commandwith_cloud_run_sandbox=True→betainserted immediately after the gcloud binary,--sandbox-launcherpresent in the commandUpdated
test_to_cloud_run_happy_pathto remove the now-incorrect assertion that--sandbox-launcheris always present.I also ran the full
tests/unittests/cli/suite. One pre-existing failure,test_telemetry_cli_commands, is unrelated to this change — confirmed viagit stashthat it fails identically on unmodifiedmain, before any of these changes are applied.Manual End-to-End (E2E) Tests:
Verified via the constructed
gcloud_cmdargument lists in unit tests (mockedsubprocess.run) rather than an actual Cloud Run deployment, since that requires a live GCP project/billing account. Manually traced the logic against the [official Cloud Run sandbox docs](https://docs.cloud.google.com/run/docs/code-execution), which confirm--sandbox-launcheris agcloud beta run deploy-only flag.Checklist###
Additional context###
Regression traced to commit
5b1088a. Reported in #6511 by @KenTandrian with exact reproduction steps and logs, which made root-causing this straightforward.