Skip to content

Default azd ai agent init to code deploy#8868

Merged
trangevi merged 4 commits into
mainfrom
trangevi/default-azd-ai-agent-init-to-code-deploy
Jun 30, 2026
Merged

Default azd ai agent init to code deploy#8868
trangevi merged 4 commits into
mainfrom
trangevi/default-azd-ai-agent-init-to-code-deploy

Conversation

@trangevi

Copy link
Copy Markdown
Member

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:

  • Interactive prompt: "Source Code (ZIP upload)" is now the first choice and pre-selected
  • --no-prompt fallback: returns "code" instead of "container"
  • userProvidedManifest auto-selection: returns "code" instead of "container"
  • Flag help text: updated to document the new default

When code deploy is selected in the template/sample flow, any Dockerfile and .dockerignore downloaded from the sample repository are now removed from the target directory since they are not needed for ZIP upload deployment.

Notes

  • --deploy-mode container explicit flag continues to work as before
  • Non-Python/non-.NET projects still default to container (the showCodeDeploy=false path is unchanged)
  • CI/CD scripts using --no-prompt without explicit --deploy-mode will now get "code" -- this is the intended behavioral change

Fixes: #8817

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>
Copilot AI review requested due to automatic review settings June 29, 2026 21:49
@github-actions

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag @RickWinter and @kristenwomack to let us know.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 code is the default across interactive, --no-prompt, and manifest-driven resolution paths.
  • Updated --deploy-mode flag help text to reflect the new default behavior.
  • Added logic to remove Dockerfile and .dockerignore from 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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Outdated
@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Jun 29, 2026

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
- 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>

@huimiu huimiu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go
trangevi and others added 2 commits June 30, 2026 09:04
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 jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@trangevi trangevi merged commit cb0d399 into main Jun 30, 2026
26 checks passed
@trangevi trangevi deleted the trangevi/default-azd-ai-agent-init-to-code-deploy branch June 30, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default azd ai agent init to code deploy

5 participants