microsoft / microsoft/aspire

Support selective resource deployment with `aspire deploy --resource <name>`

Open
#16,166 0 comments 0 reactions 0 assignees View on GitHub
area-deployment
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Problem

When working with multi-service applications, `aspire deploy` redeploys the entire application even when only a single service has changed. For inner-loop speed during active development against a deployed environment, developers need the ability to selectively deploy individual resources without re-running the full pipeline.

## Current State

The pipeline step system already generates **per-resource steps** (e.g., `build-`, `push-`), visible via `aspire do --list-steps`. However, there is no CLI-level filter to target a single resource — `aspire deploy` always executes the full pipeline for all resources.

## Proposed Experience

```bash
# Deploy only the "api" resource (build + push + deploy for just that resource)
aspire deploy --resource api

# Build only the "api" resource
aspire do build-api

# Deploy multiple specific resources
aspire deploy --resource api --resource worker
```

The `--resource` filter would:
1. Resolve the named resource(s) from the application model
2. Execute only the pipeline steps relevant to those resources (and their dependencies)
3. Skip steps for unaffected resources
4. Still run shared prerequisite steps (auth validation, parameter resolution)

## Why This Matters

- **Inner-loop speed** — Redeploying a 10-service app for a one-line change in one service is too slow
- **CI/CD efficiency** — Monorepo pipelines can deploy only changed services
- **Cost** — Avoid unnecessary container image builds and pushes for unchanged services
- **Parity with azd** — Azure Developer CLI supports `azd deploy --service ` for selective deployment
- **Agent workflows** — AI coding agents making targeted fixes should deploy only what they changed

## Implementation Notes

The infrastructure for this largely exists:
- `WellKnownPipelineSteps` already defines per-resource step patterns
- `PipelineStep` has dependency tracking via `DependsOn()` / `RequiredBy()`
- The pipeline executor could filter the step DAG to only include steps matching the target resource(s) and their transitive dependencies

The main work is:
1. Add `--resource` option to `DeployCommand` and `PipelineCommandBase`
2. Pass the filter to the AppHost pipeline executor
3. Filter the step DAG before execution

## Related Issues

- #14830 — Multi-pipeline deployment state (complementary: selective deploy + state tracking enables incremental CI/CD)
- #16090 — Parameter experience improvements (shared prereq steps should still run)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.