microsoft / microsoft/aspire

Aspire CLI deploying foundry hosted agent with 'aspire do-deploy-[agent]' takes a dependency on and deploys everything

Open
#19,666 2 comments 0 reactions 0 assignees View on GitHub
area-cli area-deployment needs-area-label triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

I have a GitHub actions pipeline that takes various inputs so you can choose which parts of my aspire app you want to deploy (everything or specific projects, which is via executing a C# script because I don't want to write yaml).

This makes calls to the aspire cli to do this using the aspire 'do' command, e.g. `aspire do deploy-[resource]`.
I wired this up so I could deploy just my hosted agent (bit of diagnostics required to find you put '-ha' on the end) so `aspire do deploy-[agent]-ha`.

This works fine for all my other project resources, if I look at the aspire do diagnostics output I typically see ~35 steps do deploy a given resource. But for some reason with the hosted agent it's got ~210 steps and seems to take a dependency on provisioning and deploying every single resource in the rest of the application.

So I can't release just the agent without every other project, website and function app going out with it.

### Expected Behavior

It should just deploy the agent and the real dependencies (foundry, project, model deployments, and in my case it references a database and two api projects in my app).

### Steps To Reproduce

Create an aspire project with a hosted agent (perhaps referencing an api project), with some other resources, say a website and an api, and run `aspire do deploy-[agent]-ha` on it. I expect you'll see everything getting deployed instead of just the agent.

### Exceptions (if any)

_No response_

### Aspire doctor output

```plain
Aspire Environment Check
========================

Aspire
✅ Aspire CLI version 13.5.2 (channel: stable)
✅ Developer Control Plane (DCP) connection health checks succeeded

AppHost
✅ AppHost version 13.5.2 (ecoDriverWeb.AppHost\ecoDriverWeb.AppHost.csproj)

.NET SDK
✅ .NET 10.0.400 installed (x64)

Container Runtime
✅ Docker v29.7.2: running (auto-detected (default)) ← active

Environment
✅ Operating system: Windows 10.0.26200.0
✅ HTTPS development certificate is trusted

Development Tools
✅ Aspire extension for VS Code is installed

Summary: 8 passed, 0 warnings, 0 failed

Aspire CLI Installations
========================

╭───────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────┬──────────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├───────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────┼──────────────┼─────────────┤
│ C:\Users\MatthewPaul\.aspire\bin\aspire.exe (current) │ 13.5.2+a22cec24d76e764b3681977e314ab4a0aeed0240 │ stable │ script │ active │
│ C:\Users\MatthewPaul\.dotnet\tools\aspire.EXE │ (not probed) │ (not probed) │ (not probed) │ shadowed │
╰───────────────────────────────────────────────────────┴─────────────────────────────────────────────────┴──────────────┴──────────────┴─────────────╯
```

### Anything else?

Quite a severe one for me as I can't merge my agent into my app and will need to be able to deploy this work soon.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in a C# Aspire AppHost with a hosted agent, additional website and API resources, and run `aspire do deploy-[agent]-ha` with diagnostics enabled. Compare the dependency steps for the hosted agent with those for other resources; done means only the agent and its real dependencies are provisioned and deployed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.