Skip to content

feat(adkgo/deploy): add --env flag to agentengine deploy subcommand#975

Open
nuthalapativarun wants to merge 1 commit into
google:mainfrom
nuthalapativarun:feat/848-env-flag-agentengine-deploy
Open

feat(adkgo/deploy): add --env flag to agentengine deploy subcommand#975
nuthalapativarun wants to merge 1 commit into
google:mainfrom
nuthalapativarun:feat/848-env-flag-agentengine-deploy

Conversation

@nuthalapativarun

Copy link
Copy Markdown

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

Root Cause / Motivation

adkgo deploy agentengine passes a fixed set of environment variables to the Agent Engine deployment. Users that need custom env vars (e.g. VERTEX_AI_LOCATION, LOG_LEVEL, third-party API keys that are not secrets) have no way to inject them.

Change

Add a repeatable --env=KEY=VALUE flag to the agentengine deploy subcommand:

adkgo deploy agentengine \
  --env=VERTEX_AI_LOCATION=us-central1 \
  --env=LOG_LEVEL=debug \
  --region=... --project_name=...

On create: extra env vars are appended after the built-in defaults (GOOGLE_CLOUD_REGION, NUM_WORKERS, OTel flags) in DeploymentSpec.Env.

On update: if --env flags are provided, DeploymentSpec is set with defaults + extra vars and "spec.deployment_spec" is added to the update mask. If no --env flags are given, update behavior is unchanged.

Values containing = are handled correctly (URL=http://x?a=1&b=2 splits on the first = only). Entries without = return a clear error.

Testing Plan

Unit Tests:

  • Added TestParseEnvVars in agentengine_test.go covering: nil input, single var, value-contains-equals, empty value, multiple vars, missing-equals error, empty-string error.
  • All existing tests pass.

Manual End-to-End (E2E) Tests:
The flag wires correctly into the cobra command. The parseEnvVars function can be verified without a live GCP project; the proto field is identical to the existing hardcoded env var entries.

$ adkgo deploy agentengine --env=FOO=bar --env=BAZ=qux ...
# DeploymentSpec.Env will contain: GOOGLE_CLOUD_REGION, NUM_WORKERS, otel vars, FOO, BAZ

Checklist

  • Read CONTRIBUTING.md
  • Self-reviewed code
  • Added tests proving the feature (parseEnvVars unit tests)
  • New and existing tests pass
  • Symmetric with the existing env var pattern in the proto request

Allow users to pass additional environment variables to the Agent Engine
deployment via a repeatable --env=KEY=VALUE flag. Variables are appended
after the built-in defaults (GOOGLE_CLOUD_REGION, NUM_WORKERS, OTel flags).

For create: extra env vars are included in the DeploymentSpec.Env slice.
For update: if --env vars are provided, DeploymentSpec is set with defaults
plus the extra vars and "spec.deployment_spec" is added to the update mask.

Parsing is validated: entries without "=" produce an error.

Closes google#848
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.

Add custom list of Env Variables to Agent Engine deployment

1 participant