Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f09bf45
Add `--publish-only` flag to `azd deploy`
JeffreyCA Aug 22, 2025
ecc7302
Create `azd publish` as alias
JeffreyCA Aug 25, 2025
cb67366
Change title depending on command
JeffreyCA Aug 25, 2025
03731aa
Update
JeffreyCA Aug 27, 2025
5ef2f72
Add `--image` and `--tag` flags
JeffreyCA Aug 27, 2025
5b33319
Clean up
JeffreyCA Aug 27, 2025
edb49e8
Support remote build
JeffreyCA Aug 27, 2025
7c5b859
Add validation
JeffreyCA Aug 27, 2025
e3b780e
Fix test
JeffreyCA Aug 27, 2025
d14d90d
Update cspell
JeffreyCA Aug 28, 2025
56946a4
Fix lll
JeffreyCA Aug 28, 2025
2ac3f50
Fix tests
JeffreyCA Aug 28, 2025
9eada61
Remove redundant return
JeffreyCA Aug 28, 2025
589d212
Fix edge case parsing image tag
JeffreyCA Sep 3, 2025
fdd83d0
Update help text
JeffreyCA Sep 3, 2025
4c53c10
Refactor publish command
JeffreyCA Sep 5, 2025
bc44805
Include Publish details in ServiceDeployResult and Package details in…
JeffreyCA Sep 5, 2025
c9f6f85
Fix header
JeffreyCA Sep 5, 2025
fdc3880
Revert some changes
JeffreyCA Sep 5, 2025
40868c7
Update text
JeffreyCA Sep 5, 2025
0d764f5
Fix test
JeffreyCA Sep 5, 2025
5454ce8
Update tests
JeffreyCA Sep 6, 2025
5a5e4ec
Fix test
JeffreyCA Sep 6, 2025
70f4c3c
Fix Aspire case
JeffreyCA Sep 6, 2025
c4f296f
Update recordings
JeffreyCA Sep 6, 2025
92b6557
Add ACA functional test and recordings
JeffreyCA Sep 8, 2025
8cd1a94
Support --from-package with --image and --tag
JeffreyCA Sep 8, 2025
e9ad834
Update warning message
JeffreyCA Sep 8, 2025
35bfdc9
Fix lint
JeffreyCA Sep 8, 2025
afb3461
Fix test
JeffreyCA Sep 8, 2025
4da2b75
Update comment
JeffreyCA Sep 10, 2025
cf06251
Replace --image and --tag with --to and remove --force-publish
JeffreyCA Sep 18, 2025
0849c50
Revert recording changes
JeffreyCA Sep 18, 2025
1797d17
Update test recordings
JeffreyCA Sep 19, 2025
572558b
Update recordings
JeffreyCA Sep 19, 2025
94e260f
Update recordings
JeffreyCA Sep 19, 2025
3d6d7b2
Update recording
JeffreyCA Sep 19, 2025
2b89a0b
Update help text and revert unneeded change
JeffreyCA Sep 22, 2025
f952042
Update help text
JeffreyCA Sep 22, 2025
3658301
Address feedback and run `mod tidy`
JeffreyCA Sep 23, 2025
a8bd4b1
Update snapshot
JeffreyCA Sep 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/azd/.vscode/cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ words:
- azcloud
- azdext
- azurefd
- azcontainerregistry
- backoff
- Canonicalize
- chinacloudapi
Expand Down
19 changes: 19 additions & 0 deletions cli/azd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,25 @@ func NewRootCmd(
UseMiddleware("hooks", middleware.NewHooksMiddleware).
UseMiddleware("extensions", middleware.NewExtensionsMiddleware)

root.
Add("publish", &actions.ActionDescriptorOptions{
Command: cmd.NewPublishCmd(),
FlagsResolver: cmd.NewPublishFlags,
ActionResolver: cmd.NewPublishAction,
OutputFormats: []output.Format{output.JsonFormat, output.NoneFormat},
DefaultFormat: output.NoneFormat,
HelpOptions: actions.ActionHelpOptions{
Description: cmd.GetCmdPublishHelpDescription,
Footer: cmd.GetCmdPublishHelpFooter,
},
GroupingOptions: actions.CommandGroupOptions{
RootLevelHelp: actions.CmdGroupAzure,
},
RequireLogin: true,
}).
UseMiddleware("hooks", middleware.NewHooksMiddleware).
UseMiddleware("extensions", middleware.NewExtensionsMiddleware)

root.
Add("up", &actions.ActionDescriptorOptions{
Command: newUpCmd(),
Expand Down
37 changes: 37 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-publish.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Publish a service to a container registry.

• Supports Container App services only.
• Target registry set by AZURE_CONTAINER_REGISTRY_ENDPOINT environment variable, docker.registry in azure.yaml, or '--to' flag.
• Use '--from-package' to publish an existing container image, otherwise azd automatically packages the container image before publishing.

Usage
azd publish <service> [flags]

Flags
--all : Publishes all services that are listed in azure.yaml
-e, --environment string : The name of the environment to use.
--from-package string : Publishes the service from a container image (image tag).
--to string : The target container image in the form '[registry/]repository[:tag]' to publish to.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd publish in your web browser.
-h, --help : Gets help for publish.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Examples
Publish all services in the current project.
azd publish --all

Publish the service named 'api' from a previously generated package.
azd publish api --from-package <image-tag>

Publish the service named 'api' with custom image name and tag.
azd publish api --to app/api:prod

Publish the service named 'api'.
azd publish api


1 change: 1 addition & 0 deletions cli/azd/cmd/testdata/TestUsage-azd.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Commands
deploy : Deploy your project code to Azure.
down : Delete your project's Azure resources.
provision : Provision Azure resources for your project.
publish : Publish a service to a container registry.

Manage and show settings
completion : Generate shell completion scripts.
Expand Down
24 changes: 21 additions & 3 deletions cli/azd/internal/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ func (da *DeployAction) Run(ctx context.Context) (*actions.ActionResult, error)
}

var packageResult *project.ServicePackageResult
var publishResult *project.ServicePublishResult

if da.flags.fromPackage != "" {
// --from-package set, skip packaging
packageResult = &project.ServicePackageResult{
Expand All @@ -260,28 +262,44 @@ func (da *DeployAction) Run(ctx context.Context) (*actions.ActionResult, error)
// --from-package not set, automatically package the application
packageResult, err = async.RunWithProgress(
func(packageProgress project.ServiceProgress) {
progressMessage := fmt.Sprintf("Deploying service %s (%s)", svc.Name, packageProgress.Message)
progressMessage := fmt.Sprintf("Packaging service %s (%s)", svc.Name, packageProgress.Message)
da.console.ShowSpinner(ctx, progressMessage, input.Step)
},
func(progress *async.Progress[project.ServiceProgress]) (*project.ServicePackageResult, error) {
return da.serviceManager.Package(ctx, svc, nil, progress, nil)
},
)

// do not stop progress here as next step is to deploy
// do not stop progress here as next step is to publish
if err != nil {
da.console.StopSpinner(ctx, stepMessage, input.StepFailed)
return nil, err
}
}

publishResult, err = async.RunWithProgress(
func(publishProgress project.ServiceProgress) {
progressMessage := fmt.Sprintf("Publishing service %s (%s)", svc.Name, publishProgress.Message)
da.console.ShowSpinner(ctx, progressMessage, input.Step)
},
func(progress *async.Progress[project.ServiceProgress]) (*project.ServicePublishResult, error) {
return da.serviceManager.Publish(ctx, svc, packageResult, progress, nil)
},
)

// do not stop progress here as next step is to deploy
if err != nil {
da.console.StopSpinner(ctx, stepMessage, input.StepFailed)
return nil, err
}

deployResult, err := async.RunWithProgress(
func(deployProgress project.ServiceProgress) {
progressMessage := fmt.Sprintf("Deploying service %s (%s)", svc.Name, deployProgress.Message)
da.console.ShowSpinner(ctx, progressMessage, input.Step)
},
func(progress *async.Progress[project.ServiceProgress]) (*project.ServiceDeployResult, error) {
return da.serviceManager.Deploy(ctx, svc, packageResult, progress)
return da.serviceManager.Deploy(ctx, svc, packageResult, publishResult, progress)
},
)

Expand Down
Loading
Loading