Skip to content

Conversation

@captainsafia
Copy link
Member

This pull request introduces the ability to run a specific deployment step and its dependencies during the deployment process. The changes add a new --step option to the CLI, update the pipeline execution logic to support step filtering, and improve error handling and test coverage for this feature.

Deployment Step Filtering Feature

  • Added a new CLI option --step to DeployCommand that allows users to specify a particular deployment step to run, along with its dependencies. (src/Aspire.Cli/Commands/DeployCommand.cs) [1] [2] [3]
  • Updated publishing options and configuration mapping to include the new Step property, enabling step filtering throughout the deployment pipeline. (src/Aspire.Hosting/Publishing/PublishingOptions.cs, src/Aspire.Hosting/DistributedApplicationBuilder.cs) [1] [2]

Pipeline Execution and Error Handling

  • Modified the pipeline execution logic to filter steps based on the specified Step property, ensuring only the requested step and its transitive dependencies are executed. Added robust error handling for invalid step names, including reporting available steps. (src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs, src/Aspire.Hosting/Publishing/Publisher.cs) [1] [2] [3]
  • Improved dependency graph validation and cycle detection to handle cases where steps may be missing or filtered out. (src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs) [1] [2]

Test Coverage

  • Added comprehensive tests to verify step filtering behavior, including correct execution of dependencies, error handling for invalid step names, and edge cases such as independent steps and complex dependency graphs. (tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs)

@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 19:19
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12287

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12287"

Copy link
Contributor

Copilot AI left a comment

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 adds support for executing a specific deployment step and its transitive dependencies during the deployment process. Users can now use the --step option in the CLI to target individual steps, which is useful for debugging, incremental deployments, or re-running failed steps.

Key Changes

  • Added --step CLI option to allow targeting specific deployment steps
  • Implemented transitive dependency computation to ensure all required dependencies are executed
  • Enhanced error reporting to show available steps when an invalid step name is provided

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Cli/Commands/DeployCommand.cs Added --step CLI option to DeployCommand
src/Aspire.Hosting/Publishing/PublishingOptions.cs Added Step property to PublishingOptions for step filtering
src/Aspire.Hosting/DistributedApplicationBuilder.cs Mapped --step CLI argument to configuration
src/Aspire.Hosting/Publishing/Publisher.cs Added error handling wrapper to report pipeline validation errors
src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs Implemented step filtering logic and transitive dependency computation
tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs Added comprehensive tests for step filtering scenarios

var pipeline = serviceProvider.GetRequiredService<IDistributedApplicationPipeline>();
await pipeline.ExecuteAsync(deployingContext).ConfigureAwait(false);
}
catch (InvalidOperationException ex)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

[nitpick] The catch block only handles InvalidOperationException, but other exception types from pipeline execution won't receive user-friendly error reporting. Consider catching a broader exception type or creating a custom exception type specifically for pipeline validation errors to ensure all validation failures are properly reported to users.

Copilot uses AI. Check for mistakes.
@captainsafia captainsafia force-pushed the safia/single-step-execution branch from 33e120b to 8dc410f Compare October 22, 2025 21:39
@captainsafia captainsafia force-pushed the safia/single-step-execution branch from 8dc410f to c2aa278 Compare October 22, 2025 21:41
@davidfowl
Copy link
Member

There's no way to know what the existing steps are so I am struggling to test this. I think we should add --steps

@davidfowl
Copy link
Member

davidfowl commented Oct 23, 2025

OK so I think after we merge this change we go all the way and re-plat publish and deploy on top of this:

aspire build -> build step (we don't have this yet)
aspire publish -> publish step
aspire deploy -> deploy step

We need a name for aspire step-exec, aspire make 😄

aspire step {step} or aspire do {step}, the other top level commands are short hand for specific steps.

activity.Data.IsError)
{
errorMessage = activity.Data.CompletionMessage;
if (errorMessage != null &&
Copy link
Member

Choose a reason for hiding this comment

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

This looks like ai slop 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Spoken by the AI Slop Master himself!

Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

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

Lots of low hanging fruit to optimize but this works as advertised!

@davidfowl davidfowl merged commit d0fa49c into main Oct 23, 2025
302 checks passed
@davidfowl davidfowl deleted the safia/single-step-execution branch October 23, 2025 05:56
@dotnet-policy-service dotnet-policy-service bot added this to the 13.0 milestone Oct 23, 2025
@captainsafia
Copy link
Member Author

There's no way to know what the existing steps are so I am struggling to test this. I think we should add --steps

Yep, the error when you provide a non-existent step name helps with this but it does rely on you knowing the conventions know.

Personally, I think it should be a --dry-run that also shows you the dependency graph so you know what transitive dependencies are going to be run when you select a single step to run.

OK so I think after we merge this change we go all the way and re-plat publish and deploy on top of this:

I ran into this while working on the Docker Compose deployer. Since we removed the behavior to automatically run publish on deploy, we need a way to generate the Docker Compose yaml when you call aspire deploy on an app with a Docker compose environment. I ended up modeling this as a new publish step in the pipeline, which naturally let to the question of how it fits in with the PublishingCallbacks, etc.

I think we've arrived at #abolishpublish a bit faster than expected 🤠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants