Is there an existing issue for this?
Describe the bug
When attempting to run aspire publish or aspire publish --list-steps on an AppHost that has a custom pipeline step registered that depends on prepare-deployment-targets-{env}, the publisher fails, complaining about duplicate Kubernetes environments.
Expected Behavior
Running aspire publish should complete successfully even when pipeline steps are registered with dependencies on the step that prepares deployment targets.
Steps To Reproduce
var builder = DistributedApplication.CreateBuilder();
var k8s = builder.AddKubernetesEnvironment("k8s");
var step = new PipelineStep
{
Name = "faulty-pipeline-step",
Action = async (ctx) => Task.CompletedTask
};
step.DependsOn("prepare-deployment-targets-k8s");
step.RequiredBy("publish-k8s");
builder.Pipeline.AddStep(step);
builder.Build().Run();
Exceptions (if any)
fail: Aspire.Hosting.Publishing.PipelineExecutor[0]
Step 'prepare-deployment-targets-k8s' failed.
System.InvalidOperationException: Step 'prepare-deployment-targets-k8s' failed: Resource 'k8s-dashboard' has
multiple compute environments - 'k8s, k8s'. Please specify a single compute environment using
'WithComputeEnvironment'.
---> System.InvalidOperationException: Resource 'k8s-dashboard' has multiple compute environments - 'k8s,
k8s'. Please specify a single compute environment using 'WithComputeEnvironment'.
at Aspire.Hosting.ApplicationModel.ResourceExtensions.GetDeploymentTargetAnnotation(IResource resource,
IComputeEnvironmentResource targetComputeEnvironment) in
/_/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs:line 1071
at Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetEffectiveComputeEnvironment(IResource
resource, IComputeEnvironmentResource& computeEnvironment) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 134
at
Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetCrossEnvironmentEndpointExpression(EndpointReferenceExpres
sion endpointReferenceExpression, IReadOnlyList`1 currentComputeEnvironments, ReferenceExpression& expression) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 89
at
Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetCrossEnvironmentEndpointExpression(EndpointReference
endpointReference, IReadOnlyList`1 currentComputeEnvironments, ReferenceExpression& expression) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 50
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessValueAsync(KubernetesEnvironmentContext context,
DistributedApplicationExecutionContext executionContext, Object value, Boolean embedded) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 510
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessEnvironmentAsync(KubernetesEnvironmentContext
environmentContext, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
in /_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 421
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessResourceAsync(KubernetesEnvironmentContext
context, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 224
at Aspire.Hosting.Kubernetes.KubernetesEnvironmentContext.CreateKubernetesResourceAsync(IResource
resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentContext.cs:line 27
at
Aspire.Hosting.Kubernetes.KubernetesEnvironmentResource.PrepareDeploymentTargetsAsync(PipelineStepContext context)
in /_/src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs:line 501
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step,
PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 1136
--- End of inner exception stack trace ---
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step,
PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 1148
at
Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass24_0.<<ExecuteStepsAsTaskDag>g__ExecuteSt
epWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 913
info: Aspire.Hosting.ParameterProcessor[0]
34 parameter values saved to deployment state.
fail: Aspire.Hosting.Publishing.PipelineExecutor[0]
Step 'prepare-deployment-targets-k8s' failed: Resource 'k8s-dashboard' has multiple compute environments -
'k8s, k8s'. Please specify a single compute environment using 'WithComputeEnvironment'.
System.InvalidOperationException: Step 'prepare-deployment-targets-k8s' failed: Resource 'k8s-dashboard' has
multiple compute environments - 'k8s, k8s'. Please specify a single compute environment using
'WithComputeEnvironment'.
---> System.InvalidOperationException: Resource 'k8s-dashboard' has multiple compute environments - 'k8s,
k8s'. Please specify a single compute environment using 'WithComputeEnvironment'.
at Aspire.Hosting.ApplicationModel.ResourceExtensions.GetDeploymentTargetAnnotation(IResource resource,
IComputeEnvironmentResource targetComputeEnvironment) in
/_/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs:line 1071
at Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetEffectiveComputeEnvironment(IResource
resource, IComputeEnvironmentResource& computeEnvironment) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 134
at
Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetCrossEnvironmentEndpointExpression(EndpointReferenceExpres
sion endpointReferenceExpression, IReadOnlyList`1 currentComputeEnvironments, ReferenceExpression& expression) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 89
at
Aspire.Hosting.ComputeEnvironmentEndpointResolver.TryGetCrossEnvironmentEndpointExpression(EndpointReference
endpointReference, IReadOnlyList`1 currentComputeEnvironments, ReferenceExpression& expression) in
/_/src/Shared/ComputeEnvironmentEndpointResolver.cs:line 50
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessValueAsync(KubernetesEnvironmentContext context,
DistributedApplicationExecutionContext executionContext, Object value, Boolean embedded) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 510
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessEnvironmentAsync(KubernetesEnvironmentContext
environmentContext, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
in /_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 421
at Aspire.Hosting.Kubernetes.KubernetesResource.ProcessResourceAsync(KubernetesEnvironmentContext
context, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesResource.cs:line 224
at Aspire.Hosting.Kubernetes.KubernetesEnvironmentContext.CreateKubernetesResourceAsync(IResource
resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken) in
/_/src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentContext.cs:line 27
at
Aspire.Hosting.Kubernetes.KubernetesEnvironmentResource.PrepareDeploymentTargetsAsync(PipelineStepContext context)
in /_/src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs:line 501
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step,
PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 1136
--- End of inner exception stack trace ---
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step,
PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 1148
at
Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass24_0.<<ExecuteStepsAsTaskDag>g__ExecuteSt
epWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 913
--- End of stack trace from previous location ---
at
Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass24_0.<<ExecuteStepsAsTaskDag>g__ExecuteSt
epWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 921
--- End of stack trace from previous location ---
at
Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass24_0.<<ExecuteStepsAsTaskDag>g__ExecuteSt
epWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 927
--- End of stack trace from previous location ---
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepsAsTaskDag(List`1 steps,
Dictionary`2 stepsByName, PipelineContext context) in
/_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 951
at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteAsync(PipelineContext context) in
/_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 585
at Aspire.Hosting.Publishing.PipelineExecutor.ExecutePipelineAsync(DistributedApplicationModel model,
CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Publishing/PipelineExecutor.cs:line 106
at Aspire.Hosting.Publishing.PipelineExecutor.ExecuteAsync(CancellationToken stoppingToken) in
/_/src/Aspire.Hosting/Publishing/PipelineExecutor.cs:line 55
Aspire doctor output
Aspire Environment Check
========================
Aspire
⚠️ Aspire CLI version 13.5.2 (channel: stable) is out of date. Latest version is 13.5.3 (channel: stable)
Run 'aspire update' to update Aspire CLI.
✅ Developer Control Plane (DCP) connection health checks succeeded
AppHost
✅ AppHost version 13.5.2 (channel: daily) (VisualRfAspire.csproj)
.NET SDK
✅ .NET 10.0.300 installed (x64)
Container Runtime
✅ Docker: running (auto-detected (default)) ← active
Environment
✅ Operating system: Linux Ubuntu 24.04
✅ WSL2 environment detected
Details:
If you experience container connectivity issues, ensure Docker Desktop WSL integration is enabled.
✅ HTTPS development certificate is trusted
⚠️ certutil is not available; browser certificate trust may be incomplete
Install certutil from your distribution's NSS tools package (for example, libnss3-tools).
See: https://aka.ms/aspire-prerequisites#dev-certs
Details:
Aspire uses certutil to query and update NSS certificate databases used by Firefox and Chromium
browsers on Linux.
Development Tools
✅ Aspire extension for VS Code is installed
Summary: 8 passed, 2 warnings, 0 failed
For detailed prerequisites: https://aka.ms/aspire-prerequisites
Aspire CLI Installations
========================
╭──────────────────────────────────┬─────────────────────────────────┬──────────────┬──────────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├──────────────────────────────────┼─────────────────────────────────┼──────────────┼──────────────┼─────────────┤
│ /home/vscode/.aspire/bin/aspire │ 13.5.2+a22cec24d76e764b3681977e │ stable │ script │ active │
│ (current) │ 314ab4a0aeed0240 │ │ │ │
│ /usr/local/bin/aspire │ (not probed) │ (not probed) │ (not probed) │ shadowed │
╰──────────────────────────────────┴─────────────────────────────────┴──────────────┴──────────────┴─────────────╯
Anything else?
aspire doctor is reporting an Aspire 13.5.3 release, which at the time of writing is not publicly released on GitHub.
I have a log file, however it contains a lot of information I'd rather not share publicly. I can sanitize it and share it here if it would be helpful. Though, the only thing I see that would be relevant is the exception that I included already.
Is there an existing issue for this?
Describe the bug
When attempting to run
aspire publishoraspire publish --list-stepson an AppHost that has a custom pipeline step registered that depends onprepare-deployment-targets-{env}, the publisher fails, complaining about duplicate Kubernetes environments.Expected Behavior
Running
aspire publishshould complete successfully even when pipeline steps are registered with dependencies on the step that prepares deployment targets.Steps To Reproduce
Exceptions (if any)
Aspire doctor output
Anything else?
aspire doctoris reporting an Aspire 13.5.3 release, which at the time of writing is not publicly released on GitHub.I have a log file, however it contains a lot of information I'd rather not share publicly. I can sanitize it and share it here if it would be helpful. Though, the only thing I see that would be relevant is the exception that I included already.