Default azd ai agent init to code deploy#8868
Conversation
Change the default deploy mode from 'container' to 'code' across all resolution paths in promptDeployMode: - Interactive prompt now defaults to 'Source Code (ZIP upload)' - --no-prompt fallback returns 'code' instead of 'container' - userProvidedManifest auto-selection returns 'code' When code deploy is selected in the manifest/template flow, remove any Dockerfile and .dockerignore from the downloaded sample directory since they are not needed for ZIP upload deployment. Update flag help text and tests to reflect the new defaults. Fixes #8817 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
Pull request overview
This pull request changes the default deployment mode for azd ai agent init to code deploy (ZIP upload) instead of container deploy, and cleans up container-specific files when code deploy is selected to reduce confusion in scaffolded projects.
Changes:
- Updated deploy-mode selection so
codeis the default across interactive,--no-prompt, and manifest-driven resolution paths. - Updated
--deploy-modeflag help text to reflect the new default behavior. - Added logic to remove
Dockerfileand.dockerignorefrom downloaded sample/template directories when code deploy is selected, and updated unit tests for deploy-mode resolution.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Updates deploy-mode flag help text and removes container-only files when code deploy is chosen. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go | Switches deploy-mode defaulting logic so code is the default and reorders interactive choices accordingly. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code_test.go | Updates unit tests to match the new default deploy-mode behavior. |
jongio
left a comment
There was a problem hiding this comment.
Small, well-scoped default change. The intent is clear and the tests cover the deploy-mode resolution logic.
One gap: removeContainerFiles has no unit test. It has specific error-handling behavior (silently ignores ENOENT, logs warnings for other errors) that would benefit from test coverage, especially since it runs unconditionally on all code-deploy selections.
jongio
left a comment
There was a problem hiding this comment.
Small, well-scoped default change. The intent is clear and the tests cover the deploy-mode resolution logic.
One gap: removeContainerFiles has no unit test. It has specific error-handling behavior (silently ignores ENOENT, logs warnings for other errors) that would benefit from test coverage, especially since it runs unconditionally on all code-deploy selections.
- Scope removeContainerFiles to GitHub-downloaded templates only, avoiding accidental deletion of user-owned Dockerfiles during local manifest init - Clarify --deploy-mode help text to note code default applies for Python/.NET projects - Add TestRemoveContainerFiles covering: removal when present, no error when absent, other files untouched Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move container file removal to after promptCodeConfig succeeds so a cancelled prompt or error does not leave the directory in an inconsistent state with files already deleted. Fix gosec G306 lint warnings by using 0600 permissions in test WriteFile calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the behavioral breaking change where --no-prompt without explicit --deploy-mode now defaults to code instead of container for Python/.NET projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
Incremental check (3 commits since my earlier review). My prior feedback about removeContainerFiles test coverage is addressed. The reordering (removal after config success) and isGitHubUrl guard that huimiu flagged are also resolved in the latest commits.
One open point from huimiu: surfacing the file removal via user-visible output instead of log.Printf. I think the current approach is fine. The guard limits removal to downloaded template files and the user explicitly chose code deploy, so the removal is expected behavior. The changelog entry documents it for anyone upgrading.
Why
Code deploy is ready to be the default deployment mode for
azd ai agent init. Currently the default is "container" (Docker image), which requires Dockerfile management and ACR setup that most users don't need for simple agent projects.What changed
Changed
promptDeployMode()so "code" (ZIP upload) is the default across all resolution paths:--no-promptfallback: returns "code" instead of "container"userProvidedManifestauto-selection: returns "code" instead of "container"When code deploy is selected in the template/sample flow, any
Dockerfileand.dockerignoredownloaded from the sample repository are now removed from the target directory since they are not needed for ZIP upload deployment.Notes
--deploy-mode containerexplicit flag continues to work as beforeshowCodeDeploy=falsepath is unchanged)--no-promptwithout explicit--deploy-modewill now get "code" -- this is the intended behavioral changeFixes: #8817