feat: support code deploy in --no-prompt mode via CLI flags#8324
Merged
Conversation
Add --deploy-mode, --runtime, --entry-point, and --dep-resolution flags to enable non-interactive code deploy for CI/CD pipelines. - --deploy-mode code|container (default: container, backward compatible) - --runtime python_3_13|python_3_14|dotnet_10 (required for code deploy) - --entry-point <file> (required for code deploy) - --dep-resolution remote_build|bundled (default: remote_build) These flags produce the same output as interactive mode (agent.yaml code_configuration + azure.yaml language field + SKIP_ACR_CREATION env var). No changes to deploy-time behavior.
added 3 commits
May 22, 2026 16:14
… promptCodeConfig Extract validateCodeDeployFlags into a testable method and add 16 test cases covering flag precedence, noPrompt defaults, and error conditions.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds non-interactive (“--no-prompt”) support for code deploy in azd ai agent init by introducing CLI flags that allow CI/CD pipelines to fully specify deploy mode and code-deploy configuration without prompts.
Changes:
- Adds
--deploy-mode,--runtime,--entry-point, and--dep-resolutionflags toazd ai agent init. - Implements shared validation for required flags in
--no-prompt+--deploy-mode codeflows and threads flag overrides into the existing prompt helpers. - Adds unit tests covering deploy-mode flag precedence, code config flag overrides, and required-flag validation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Registers new CLI flags, validates required inputs for non-interactive code deploy, updates help/examples, and passes flag overrides into prompting. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go |
Updates deploy-mode and code-config prompt helpers to accept flag overrides and validates required flags in the init-from-code flow. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_test.go |
Adds tests for required-flag validation behavior in --no-prompt + code deploy mode. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code_test.go |
Adds tests for deploy-mode flag precedence and code-config flag override behavior. |
Comments suppressed due to low confidence (1)
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go:1292
- When
opts.runtimeis provided (via--runtime), it’s accepted verbatim without validation against the supported runtime values shown in the prompt/help text. This can produce anagent.yamlwith an invalid runtime and later failures (e.g., wrong command prefix). Add validation foropts.runtime(and ideally for interactive flag usage too) to ensure it matches one of the supported values (python_3_13/python_3_14/dotnet_10) and return a structured validation error when invalid.
var runtime string
if opts.runtime != "" {
runtime = opts.runtime
} else if noPrompt {
if isDotnet && !isPython {
runtime = "dotnet_10"
} else {
runtime = "python_3_13" // default to Python for mixed/unknown repos (language preference, not version compat)
trangevi
approved these changes
May 22, 2026
Member
|
/check-enforcer override |
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.
Summary
Adds
--deploy-mode,--runtime,--entry-point, and--dep-resolutionflags toazd ai agent initfor non-interactive code deploy support in CI/CD pipelines.Closes #8323
What this PR changes
In
--no-promptmode, the deploy mode was hardcoded to"container"with no way to select code deploy. This PR adds four new flags:--deploy-modecontainer,codecontainer--runtimepython_3_13,python_3_14,dotnet_10--deploy-mode code --no-prompt--entry-pointapp.py)--deploy-mode code --no-prompt--dep-resolutionremote_build,bundledremote_buildExample usage
Interaction with existing
--no-promptbehaviorThis PR does not change how
--no-prompthandles Foundry project or model deployment selection. The existing behavior remains:--no-promptbehavior (unchanged)--project-idis required (must be an existing project). Without it, init errors out with a hint to pass--project-id.--model-deploymentis passed, looks up that deployment in the Foundry project. If not passed, auto-selects the first matching deployment. If none exist, auto-configures a new deployment from the catalog (requiresazd up).azd deploy. New deployment created →azd up(provision needed to create the model deployment via Bicep).The new
--deploy-mode/--runtime/--entry-pointflags only control how the agent code is packaged and deployed (container image vs ZIP upload). They are orthogonal to project and model selection.Tests added
TestPromptDeployMode_FlagOverrideΓÇö 6 cases: flag precedence, invalid flag error, noPrompt defaultTestPromptCodeConfig_FlagOverridesΓÇö 5 cases: opts override, noPrompt defaults for Python/dotnetTestCodeDeployFlagValidationΓÇö 5 cases: validates required flags in noPrompt+code modeE2E Test Results
Build:
azd x build --cwd cli/azd/extensions/azure.ai.agentson branchfeat/no-prompt-code-deployExtension: 0.1.33-preview (local dev build)
Project: Existing Foundry project in North Central US with gpt-4.1-mini deployment
Test Matrix
--deploy-mode code --runtime python_3_13 --entry-point main.py --dep-resolution remote_build--deploy-mode code --runtime python_3_13 --entry-point main.py --dep-resolution bundled--deploy-mode code --entry-point main.py--deploy-mode code --runtime python_3_13--deploy-mode invalid--deploy-mode containerKey Verifications
azd ai agent init --no-promptwith all flagsagent.yamlcontains correctcode_configuration(runtime, entry_point, dependency_resolution)azd deploysucceeds agent invoke returns valid LLM response--deploy-modeflag still defaults to container (backward compatible)All tests used
--no-promptmode with-m <manifestUrl>and--project-id.