From 36379abc0c6765ff582fc59155a4d5d775c9d32d Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 28 Apr 2026 19:23:05 -0500 Subject: [PATCH 1/8] Validate build-only container references in the pipeline Add the publish/deploy validation step and implement the opt-out by clearing its RequiredBySteps during pipeline configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ...DistributedApplicationBuilderExtensions.cs | 29 +++++ .../DistributedApplicationPipeline.cs | 56 +++++++++ .../AzureDeployerTests.cs | 1 + .../BuildOnlyContainerValidationTests.cs | 114 ++++++++++++++++++ .../DistributedApplicationPipelineTests.cs | 3 +- 5 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs diff --git a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs index 94b31924943..1c3c000524b 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs @@ -1,8 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable ASPIREPIPELINES001 + using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; +using Aspire.Hosting.Pipelines; namespace Aspire.Hosting; @@ -107,5 +110,31 @@ public static bool TryCreateResourceBuilder(this IDistributedApplicationBuild resourceBuilder = builder.CreateResourceBuilder(typedResource); return true; } + + /// + /// Disables the publish and deploy validation that requires build-only containers to be consumed by another resource. + /// + /// The distributed application builder. + /// The distributed application builder for chaining. + /// + /// This is an application-wide escape hatch for scenarios where the build-only container validation is too restrictive + /// for a particular app. Prefer wiring build-only containers through PublishWithContainerFiles or + /// PublishWithStaticFiles when possible. + /// + [AspireExport(Description = "Disables publish and deploy validation for unconsumed build-only containers.")] + [Experimental("ASPIREPIPELINES001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] + public static IDistributedApplicationBuilder DisableBuildOnlyContainerValidation(this IDistributedApplicationBuilder builder) + { + ArgumentNullException.ThrowIfNull(builder); + + builder.Pipeline.AddPipelineConfiguration(static context => + { + var validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); + validationStep.RequiredBySteps.Clear(); + return Task.CompletedTask; + }); + + return builder; + } } diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs index 1e2bdad15da..5ed871da812 100644 --- a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs @@ -24,6 +24,8 @@ namespace Aspire.Hosting.Pipelines; [DebuggerDisplay("{ToString(),nq}")] internal sealed class DistributedApplicationPipeline : IDistributedApplicationPipeline { + internal const string ValidateBuildOnlyContainerReferencesStepName = "validate-build-only-container-references"; + private readonly List _steps = []; private readonly List> _configurationCallbacks = []; @@ -310,6 +312,18 @@ public DistributedApplicationPipeline() Action = _ => Task.CompletedTask, }); + _steps.Add(new PipelineStep + { + Name = ValidateBuildOnlyContainerReferencesStepName, + Description = "Validates that build-only containers are consumed by another resource before publish or deploy.", + Action = static context => + { + ValidateBuildOnlyContainerReferences(context.Model); + return Task.CompletedTask; + }, + RequiredBySteps = [WellKnownPipelineSteps.PublishPrereq, WellKnownPipelineSteps.DeployPrereq], + }); + // Add diagnostic step for dependency graph analysis _steps.Add(new PipelineStep { @@ -398,6 +412,48 @@ private static void ValidateComputeEnvironmentBindings(DistributedApplicationMod $"Specify which environment each resource should target by calling 'WithComputeEnvironment' on the resource builder."); } + private static void ValidateBuildOnlyContainerReferences(DistributedApplicationModel model) + { + var buildOnlyContainers = model.GetBuildResources() + .Where(resource => resource.IsBuildOnlyContainer() && !resource.IsExcludedFromPublish()) + .ToList(); + + if (buildOnlyContainers.Count == 0) + { + return; + } + + var consumedBuildOnlyContainerNames = new HashSet(StringComparer.OrdinalIgnoreCase); + + foreach (var resource in model.Resources) + { + if (resource.IsExcludedFromPublish()) + { + continue; + } + + foreach (var annotation in resource.Annotations.OfType()) + { + if (!string.Equals(resource.Name, annotation.Source.Name, StringComparison.OrdinalIgnoreCase)) + { + consumedBuildOnlyContainerNames.Add(annotation.Source.Name); + } + } + } + + var unconsumedBuildOnlyContainers = buildOnlyContainers + .Where(resource => !consumedBuildOnlyContainerNames.Contains(resource.Name)) + .ToList(); + + if (unconsumedBuildOnlyContainers.Count > 0) + { + var resourceNames = string.Join("', '", unconsumedBuildOnlyContainers.Select(resource => resource.Name)); + throw new DistributedApplicationException( + $"Build-only container resource(s) '{resourceNames}' are not consumed by another resource and won't participate in publish or deploy. " + + $"Reference them from another resource using 'PublishWithContainerFiles' or 'PublishWithStaticFiles', or suppress this validation for the app by calling 'builder.DisableBuildOnlyContainerValidation()'."); + } + } + public bool HasSteps => _steps.Count > 0; public void AddStep(string name, diff --git a/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs b/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs index cb59c6a75c7..7430e184a5b 100644 --- a/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs +++ b/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs @@ -158,6 +158,7 @@ public async Task DeployAsync_WithBuildOnlyContainers() }; }); ConfigureTestServices(builder, armClientProvider: armClientProvider, activityReporter: mockActivityReporter); + builder.DisableBuildOnlyContainerValidation(); var containerAppEnv = builder.AddAzureContainerAppEnvironment("env"); diff --git a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs new file mode 100644 index 00000000000..d2ab5eea167 --- /dev/null +++ b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma warning disable ASPIREPIPELINES001 + +using Aspire.Hosting.Pipelines; +using Aspire.Hosting.Utils; +using Microsoft.AspNetCore.InternalTesting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Aspire.Hosting.Tests; + +[Trait("Partition", "6")] +public class BuildOnlyContainerValidationTests +{ + [Fact] + public async Task PublishPrereq_WithUnconsumedBuildOnlyContainer_Throws() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.PublishPrereq); + + AddBuildOnlyContainer(builder, "frontend"); + + using var app = builder.Build(); + + var ex = await Assert.ThrowsAsync( + () => ExecutePipelineAsync(app)).DefaultTimeout(); + + Assert.Contains("'frontend'", ex.Message); + Assert.Contains("PublishWithContainerFiles", ex.Message); + Assert.Contains("DisableBuildOnlyContainerValidation", ex.Message); + } + + [Fact] + public async Task DeployPrereq_WithUnconsumedBuildOnlyContainer_Throws() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.DeployPrereq); + + AddBuildOnlyContainer(builder, "frontend"); + + using var app = builder.Build(); + + var ex = await Assert.ThrowsAsync( + () => ExecutePipelineAsync(app)).DefaultTimeout(); + + Assert.Contains("'frontend'", ex.Message); + } + + [Fact] + public async Task PublishPrereq_WithConsumedBuildOnlyContainer_DoesNotThrow() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.PublishPrereq); + + var source = AddBuildOnlyContainer(builder, "frontend"); + builder.AddResource(new TestContainerFilesDestinationResource("api")) + .PublishWithContainerFiles(source, "/app/wwwroot"); + + using var app = builder.Build(); + + await ExecutePipelineAsync(app).DefaultTimeout(); + } + + [Fact] + public async Task PublishPrereq_WithValidationDisabled_DoesNotThrow() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.PublishPrereq); + + PipelineStep? validationStep = null; + builder.DisableBuildOnlyContainerValidation(); + builder.Pipeline.AddPipelineConfiguration(context => + { + validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); + return Task.CompletedTask; + }); + AddBuildOnlyContainer(builder, "frontend"); + + using var app = builder.Build(); + + await ExecutePipelineAsync(app).DefaultTimeout(); + + Assert.NotNull(validationStep); + Assert.Empty(validationStep.RequiredBySteps); + } + + private static IResourceBuilder AddBuildOnlyContainer( + IDistributedApplicationBuilder builder, + string name) + { + return builder.AddResource(new TestContainerFilesSourceResource(name)) + .WithAnnotation(new DockerfileBuildAnnotation("context", "Dockerfile", null) { HasEntrypoint = false }) + .WithAnnotation(new ContainerFilesSourceAnnotation { SourcePath = "/app/dist" }); + } + + private static Task ExecutePipelineAsync(DistributedApplication app) + { + var pipeline = app.Services.GetRequiredService(); + var context = new PipelineContext( + app.Services.GetRequiredService(), + app.Services.GetRequiredService(), + app.Services, + app.Services.GetRequiredService>(), + CancellationToken.None); + + return pipeline.ExecuteAsync(context); + } + + private sealed class TestContainerFilesSourceResource(string name) : ContainerResource(name), IResourceWithContainerFiles + { + } + + private sealed class TestContainerFilesDestinationResource(string name) : ContainerResource(name), IContainerFilesDestinationResource + { + } +} diff --git a/tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs b/tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs index 68fbc01387e..cfca7ae5820 100644 --- a/tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs +++ b/tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs @@ -1558,7 +1558,7 @@ public async Task ExecuteAsync_WithConfigurationCallback_ExecutesCallback() await pipeline.ExecuteAsync(context).DefaultTimeout(); Assert.True(callbackExecuted); - Assert.Equal(17, capturedSteps.Count); // Default steps: deploy, deploy-prereq, process-parameters, build, build-prereq, check-container-runtime, push, push-prereq, publish, publish-prereq, diagnostics, validate-compute-environments, before-start, destroy, destroy-prereq + step1, step2 + Assert.Equal(18, capturedSteps.Count); // Default steps: deploy, deploy-prereq, process-parameters, build, build-prereq, check-container-runtime, push, push-prereq, publish, publish-prereq, validate-build-only-container-references, diagnostics, validate-compute-environments, before-start, destroy, destroy-prereq + step1, step2 Assert.Contains(capturedSteps, s => s.Name == "deploy"); Assert.Contains(capturedSteps, s => s.Name == "process-parameters"); Assert.Contains(capturedSteps, s => s.Name == "deploy-prereq"); @@ -1568,6 +1568,7 @@ public async Task ExecuteAsync_WithConfigurationCallback_ExecutesCallback() Assert.Contains(capturedSteps, s => s.Name == "push-prereq"); Assert.Contains(capturedSteps, s => s.Name == "publish"); Assert.Contains(capturedSteps, s => s.Name == "publish-prereq"); + Assert.Contains(capturedSteps, s => s.Name == "validate-build-only-container-references"); Assert.Contains(capturedSteps, s => s.Name == "diagnostics"); Assert.Contains(capturedSteps, s => s.Name == "validate-compute-environments"); Assert.Contains(capturedSteps, s => s.Name == "before-start"); From d8226a5e515aa23e2f05f6cd6b5fc09a3c50aec4 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 12:58:52 -0500 Subject: [PATCH 2/8] Fix tests --- ..._DoesNotHang_step=diagnostics.verified.txt | 179 +++++++------ ...nments_Works_step=diagnostics.verified.txt | 239 +++++++++-------- ...ts_CreatesCorrectDependencies.verified.txt | 251 +++++++++--------- ...on_CreatesCorrectDependencies.verified.txt | 221 +++++++-------- 4 files changed, 467 insertions(+), 423 deletions(-) diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt index 53773bb6d4b..6721d545ce8 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt @@ -1,11 +1,11 @@ -[ +[ PIPELINE DEPENDENCY GRAPH DIAGNOSTICS ===================================== This diagnostic output shows the complete pipeline dependency graph structure. Use this to understand step relationships and troubleshoot execution issues. -Total steps defined: 37 +Total steps defined: 38 Analysis for full pipeline execution (showing all steps and their relationships) @@ -22,35 +22,36 @@ Steps with no dependencies run first, followed by steps that depend on them. 6. process-parameters 7. build-prereq 8. check-container-runtime - 9. deploy-prereq - 10. build-api - 11. build - 12. validate-azure-login - 13. create-provisioning-context - 14. provision-api-identity - 15. provision-kv - 16. provision-api-roles-kv - 17. provision-env-acr - 18. provision-env - 19. login-to-acr-env-acr - 20. push-prereq - 21. push-api - 22. provision-api-website - 23. print-api-summary - 24. provision-azure-bicep-resources - 25. print-dashboard-url-env - 26. deploy - 27. deploy-api - 28. destroy-prereq - 29. destroy-azure-azure634f9 - 30. destroy - 31. diagnostics - 32. publish-prereq - 33. publish-azure634f9 - 34. validate-appservice-config-env - 35. publish - 36. publish-manifest - 37. push + 9. validate-build-only-container-references + 10. deploy-prereq + 11. build-api + 12. build + 13. validate-azure-login + 14. create-provisioning-context + 15. provision-api-identity + 16. provision-kv + 17. provision-api-roles-kv + 18. provision-env-acr + 19. provision-env + 20. login-to-acr-env-acr + 21. push-prereq + 22. push-api + 23. provision-api-website + 24. print-api-summary + 25. provision-azure-bicep-resources + 26. print-dashboard-url-env + 27. deploy + 28. deploy-api + 29. destroy-prereq + 30. destroy-azure-azure634f9 + 31. destroy + 32. diagnostics + 33. publish-prereq + 34. publish-azure634f9 + 35. validate-appservice-config-env + 36. publish + 37. publish-manifest + 38. push DETAILED STEP ANALYSIS ====================== @@ -101,7 +102,7 @@ Step: deploy-api Step: deploy-prereq Description: Prerequisite step that runs before any deploy operations. Initializes deployment environment and manages deployment state. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: destroy Description: Aggregation step for all destroy operations. All destroy steps should be required by this step. @@ -203,7 +204,7 @@ Step: publish-manifest Step: publish-prereq Description: Prerequisite step that runs before any publish operations. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: push Description: Aggregation step for all push operations. All push steps should be required by this step. @@ -231,6 +232,10 @@ Step: validate-azure-login Dependencies: ✓ deploy-prereq Resource: azure634f9 (AzureEnvironmentResource) +Step: validate-build-only-container-references + Description: Validates that build-only containers are consumed by another resource before publish or deploy. + Dependencies: none + Step: validate-compute-environments Description: Validates compute resource bindings before startup. Dependencies: none @@ -262,18 +267,18 @@ If targeting 'before-start': If targeting 'build': Direct dependencies: build-api - Total steps: 6 + Total steps: 7 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api [3] build If targeting 'build-api': Direct dependencies: build-prereq, check-container-runtime, deploy-prereq - Total steps: 5 + Total steps: 6 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api @@ -292,18 +297,18 @@ If targeting 'check-container-runtime': If targeting 'create-provisioning-context': Direct dependencies: deploy-prereq, validate-azure-login - Total steps: 4 + Total steps: 5 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context If targeting 'deploy': Direct dependencies: build-api, create-provisioning-context, print-api-summary, print-dashboard-url-env, provision-azure-bicep-resources, validate-azure-login - Total steps: 20 + Total steps: 21 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -318,9 +323,9 @@ If targeting 'deploy': If targeting 'deploy-api': Direct dependencies: print-api-summary - Total steps: 18 + Total steps: 19 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -333,10 +338,10 @@ If targeting 'deploy-api': [10] deploy-api If targeting 'deploy-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq If targeting 'destroy': @@ -368,9 +373,9 @@ If targeting 'diagnostics': If targeting 'login-to-acr-env-acr': Direct dependencies: provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -386,9 +391,9 @@ If targeting 'prepare-azure-app-service-env': If targeting 'print-api-summary': Direct dependencies: provision-api-website - Total steps: 17 + Total steps: 18 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -401,9 +406,9 @@ If targeting 'print-api-summary': If targeting 'print-dashboard-url-env': Direct dependencies: provision-azure-bicep-resources, provision-env - Total steps: 18 + Total steps: 19 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -423,9 +428,9 @@ If targeting 'process-parameters': If targeting 'provision-api-identity': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -433,9 +438,9 @@ If targeting 'provision-api-identity': If targeting 'provision-api-roles-kv': Direct dependencies: create-provisioning-context, provision-api-identity, provision-kv - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -444,9 +449,9 @@ If targeting 'provision-api-roles-kv': If targeting 'provision-api-website': Direct dependencies: create-provisioning-context, provision-api-identity, provision-api-roles-kv, provision-env, provision-kv, push-api - Total steps: 16 + Total steps: 17 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -458,9 +463,9 @@ If targeting 'provision-api-website': If targeting 'provision-azure-bicep-resources': Direct dependencies: create-provisioning-context, deploy-prereq, provision-api-identity, provision-api-roles-kv, provision-api-website, provision-env, provision-env-acr, provision-kv - Total steps: 17 + Total steps: 18 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -473,9 +478,9 @@ If targeting 'provision-azure-bicep-resources': If targeting 'provision-env': Direct dependencies: create-provisioning-context, provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -484,9 +489,9 @@ If targeting 'provision-env': If targeting 'provision-env-acr': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -494,9 +499,9 @@ If targeting 'provision-env-acr': If targeting 'provision-kv': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -504,18 +509,18 @@ If targeting 'provision-kv': If targeting 'publish': Direct dependencies: publish-azure634f9, validate-appservice-config-env - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 | validate-appservice-config-env (parallel) [3] publish If targeting 'publish-azure634f9': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 @@ -526,17 +531,17 @@ If targeting 'publish-manifest': [0] publish-manifest If targeting 'publish-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq If targeting 'push': Direct dependencies: push-api, push-prereq - Total steps: 12 + Total steps: 13 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -548,9 +553,9 @@ If targeting 'push': If targeting 'push-api': Direct dependencies: build-api, push-prereq - Total steps: 11 + Total steps: 12 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -561,9 +566,9 @@ If targeting 'push-api': If targeting 'push-prereq': Direct dependencies: login-to-acr-env-acr - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -573,9 +578,9 @@ If targeting 'push-prereq': If targeting 'validate-appservice-config-env': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] validate-appservice-config-env @@ -587,12 +592,18 @@ If targeting 'validate-azure-app-service': If targeting 'validate-azure-login': Direct dependencies: deploy-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login +If targeting 'validate-build-only-container-references': + Direct dependencies: none + Total steps: 1 + Execution order: + [0] validate-build-only-container-references + If targeting 'validate-compute-environments': Direct dependencies: none Total steps: 1 @@ -600,4 +611,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt index c4d840f8c50..c80d16eb9bc 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt @@ -1,11 +1,11 @@ -[ +[ PIPELINE DEPENDENCY GRAPH DIAGNOSTICS ===================================== This diagnostic output shows the complete pipeline dependency graph structure. Use this to understand step relationships and troubleshoot execution issues. -Total steps defined: 49 +Total steps defined: 50 Analysis for full pipeline execution (showing all steps and their relationships) @@ -24,45 +24,46 @@ Steps with no dependencies run first, followed by steps that depend on them. 8. process-parameters 9. build-prereq 10. check-container-runtime - 11. deploy-prereq - 12. build-api-service - 13. build-python-app - 14. build - 15. validate-azure-login - 16. create-provisioning-context - 17. provision-aas-env-acr - 18. provision-aas-env - 19. login-to-acr-aas-env-acr - 20. provision-aca-env-acr - 21. login-to-acr-aca-env-acr - 22. push-prereq - 23. push-api-service - 24. provision-api-service-website - 25. print-api-service-summary - 26. provision-aca-env - 27. provision-cache-containerapp - 28. print-cache-summary - 29. push-python-app - 30. provision-python-app-containerapp - 31. provision-storage - 32. provision-azure-bicep-resources - 33. print-dashboard-url-aas-env - 34. print-dashboard-url-aca-env - 35. print-python-app-summary - 36. deploy - 37. deploy-api-service - 38. deploy-cache - 39. deploy-python-app - 40. destroy-prereq - 41. destroy-azure-azure634f9 - 42. destroy - 43. diagnostics - 44. publish-prereq - 45. publish-azure634f9 - 46. validate-appservice-config-aas-env - 47. publish - 48. publish-manifest - 49. push + 11. validate-build-only-container-references + 12. deploy-prereq + 13. build-api-service + 14. build-python-app + 15. build + 16. validate-azure-login + 17. create-provisioning-context + 18. provision-aas-env-acr + 19. provision-aas-env + 20. login-to-acr-aas-env-acr + 21. provision-aca-env-acr + 22. login-to-acr-aca-env-acr + 23. push-prereq + 24. push-api-service + 25. provision-api-service-website + 26. print-api-service-summary + 27. provision-aca-env + 28. provision-cache-containerapp + 29. print-cache-summary + 30. push-python-app + 31. provision-python-app-containerapp + 32. provision-storage + 33. provision-azure-bicep-resources + 34. print-dashboard-url-aas-env + 35. print-dashboard-url-aca-env + 36. print-python-app-summary + 37. deploy + 38. deploy-api-service + 39. deploy-cache + 40. deploy-python-app + 41. destroy-prereq + 42. destroy-azure-azure634f9 + 43. destroy + 44. diagnostics + 45. publish-prereq + 46. publish-azure634f9 + 47. validate-appservice-config-aas-env + 48. publish + 49. publish-manifest + 50. push DETAILED STEP ANALYSIS ====================== @@ -124,7 +125,7 @@ Step: deploy-cache Step: deploy-prereq Description: Prerequisite step that runs before any deploy operations. Initializes deployment environment and manages deployment state. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: deploy-python-app Description: Aggregation step for deploying python-app to Azure Container Apps. @@ -272,7 +273,7 @@ Step: publish-manifest Step: publish-prereq Description: Prerequisite step that runs before any publish operations. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: push Description: Aggregation step for all push operations. All push steps should be required by this step. @@ -308,6 +309,10 @@ Step: validate-azure-login Dependencies: ✓ deploy-prereq Resource: azure634f9 (AzureEnvironmentResource) +Step: validate-build-only-container-references + Description: Validates that build-only containers are consumed by another resource before publish or deploy. + Dependencies: none + Step: validate-compute-environments Description: Validates compute resource bindings before startup. Dependencies: none @@ -339,18 +344,18 @@ If targeting 'before-start': If targeting 'build': Direct dependencies: build-api-service, build-python-app - Total steps: 7 + Total steps: 8 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app (parallel) [3] build If targeting 'build-api-service': Direct dependencies: build-prereq, check-container-runtime, deploy-prereq, deploy-prereq - Total steps: 5 + Total steps: 6 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service @@ -363,9 +368,9 @@ If targeting 'build-prereq': If targeting 'build-python-app': Direct dependencies: build-prereq, check-container-runtime, deploy-prereq, deploy-prereq - Total steps: 5 + Total steps: 6 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-python-app @@ -377,18 +382,18 @@ If targeting 'check-container-runtime': If targeting 'create-provisioning-context': Direct dependencies: deploy-prereq, validate-azure-login - Total steps: 4 + Total steps: 5 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context If targeting 'deploy': Direct dependencies: build-api-service, build-python-app, create-provisioning-context, print-api-service-summary, print-cache-summary, print-dashboard-url-aas-env, print-dashboard-url-aca-env, print-python-app-summary, provision-azure-bicep-resources, validate-azure-login - Total steps: 28 + Total steps: 29 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -403,9 +408,9 @@ If targeting 'deploy': If targeting 'deploy-api-service': Direct dependencies: print-api-service-summary - Total steps: 17 + Total steps: 18 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | validate-azure-login (parallel) [3] create-provisioning-context @@ -419,9 +424,9 @@ If targeting 'deploy-api-service': If targeting 'deploy-cache': Direct dependencies: print-cache-summary - Total steps: 9 + Total steps: 10 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -432,17 +437,17 @@ If targeting 'deploy-cache': [8] deploy-cache If targeting 'deploy-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq If targeting 'deploy-python-app': Direct dependencies: print-python-app-summary - Total steps: 17 + Total steps: 18 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -483,9 +488,9 @@ If targeting 'diagnostics': If targeting 'login-to-acr-aas-env-acr': Direct dependencies: provision-aas-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -494,9 +499,9 @@ If targeting 'login-to-acr-aas-env-acr': If targeting 'login-to-acr-aca-env-acr': Direct dependencies: provision-aca-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -519,9 +524,9 @@ If targeting 'prepare-azure-container-apps-aca-env': If targeting 'print-api-service-summary': Direct dependencies: provision-api-service-website - Total steps: 16 + Total steps: 17 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | validate-azure-login (parallel) [3] create-provisioning-context @@ -534,9 +539,9 @@ If targeting 'print-api-service-summary': If targeting 'print-cache-summary': Direct dependencies: provision-cache-containerapp - Total steps: 8 + Total steps: 9 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -547,9 +552,9 @@ If targeting 'print-cache-summary': If targeting 'print-dashboard-url-aas-env': Direct dependencies: provision-aas-env, provision-azure-bicep-resources - Total steps: 23 + Total steps: 24 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -563,9 +568,9 @@ If targeting 'print-dashboard-url-aas-env': If targeting 'print-dashboard-url-aca-env': Direct dependencies: provision-aca-env, provision-azure-bicep-resources - Total steps: 23 + Total steps: 24 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -579,9 +584,9 @@ If targeting 'print-dashboard-url-aca-env': If targeting 'print-python-app-summary': Direct dependencies: provision-python-app-containerapp - Total steps: 16 + Total steps: 17 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -600,9 +605,9 @@ If targeting 'process-parameters': If targeting 'provision-aas-env': Direct dependencies: create-provisioning-context, provision-aas-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -611,9 +616,9 @@ If targeting 'provision-aas-env': If targeting 'provision-aas-env-acr': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -621,9 +626,9 @@ If targeting 'provision-aas-env-acr': If targeting 'provision-aca-env': Direct dependencies: create-provisioning-context, provision-aca-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -632,9 +637,9 @@ If targeting 'provision-aca-env': If targeting 'provision-aca-env-acr': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -642,9 +647,9 @@ If targeting 'provision-aca-env-acr': If targeting 'provision-api-service-website': Direct dependencies: create-provisioning-context, provision-aas-env, push-api-service - Total steps: 15 + Total steps: 16 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | validate-azure-login (parallel) [3] create-provisioning-context @@ -656,9 +661,9 @@ If targeting 'provision-api-service-website': If targeting 'provision-azure-bicep-resources': Direct dependencies: create-provisioning-context, deploy-prereq, provision-aas-env, provision-aas-env-acr, provision-aca-env, provision-aca-env-acr, provision-api-service-website, provision-cache-containerapp, provision-python-app-containerapp, provision-storage - Total steps: 22 + Total steps: 23 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -671,9 +676,9 @@ If targeting 'provision-azure-bicep-resources': If targeting 'provision-cache-containerapp': Direct dependencies: create-provisioning-context, provision-aca-env - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -683,9 +688,9 @@ If targeting 'provision-cache-containerapp': If targeting 'provision-python-app-containerapp': Direct dependencies: create-provisioning-context, provision-aca-env, push-python-app - Total steps: 15 + Total steps: 16 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -697,9 +702,9 @@ If targeting 'provision-python-app-containerapp': If targeting 'provision-storage': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -707,18 +712,18 @@ If targeting 'provision-storage': If targeting 'publish': Direct dependencies: publish-azure634f9, validate-appservice-config-aas-env - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 | validate-appservice-config-aas-env (parallel) [3] publish If targeting 'publish-azure634f9': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 @@ -729,17 +734,17 @@ If targeting 'publish-manifest': [0] publish-manifest If targeting 'publish-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq If targeting 'push': Direct dependencies: push-api-service, push-prereq, push-python-app - Total steps: 16 + Total steps: 17 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -751,9 +756,9 @@ If targeting 'push': If targeting 'push-api-service': Direct dependencies: build-api-service, push-prereq - Total steps: 13 + Total steps: 14 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api-service | validate-azure-login (parallel) [3] create-provisioning-context @@ -764,9 +769,9 @@ If targeting 'push-api-service': If targeting 'push-prereq': Direct dependencies: login-to-acr-aas-env-acr, login-to-acr-aca-env-acr - Total steps: 9 + Total steps: 10 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -776,9 +781,9 @@ If targeting 'push-prereq': If targeting 'push-python-app': Direct dependencies: build-python-app, push-prereq - Total steps: 13 + Total steps: 14 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-python-app | validate-azure-login (parallel) [3] create-provisioning-context @@ -789,9 +794,9 @@ If targeting 'push-python-app': If targeting 'validate-appservice-config-aas-env': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] validate-appservice-config-aas-env @@ -809,12 +814,18 @@ If targeting 'validate-azure-container-apps': If targeting 'validate-azure-login': Direct dependencies: deploy-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login +If targeting 'validate-build-only-container-references': + Direct dependencies: none + Total steps: 1 + Execution order: + [0] validate-build-only-container-references + If targeting 'validate-compute-environments': Direct dependencies: none Total steps: 1 @@ -822,4 +833,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt index 1350cc2aaf6..e2ab85d8610 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt @@ -1,11 +1,11 @@ -[ +[ PIPELINE DEPENDENCY GRAPH DIAGNOSTICS ===================================== This diagnostic output shows the complete pipeline dependency graph structure. Use this to understand step relationships and troubleshoot execution issues. -Total steps defined: 49 +Total steps defined: 50 Analysis for full pipeline execution (showing all steps and their relationships) @@ -22,47 +22,48 @@ Steps with no dependencies run first, followed by steps that depend on them. 6. process-parameters 7. build-prereq 8. check-container-runtime - 9. deploy-prereq - 10. build-api - 11. build - 12. validate-azure-login - 13. create-provisioning-context - 14. provision-api-identity - 15. provision-cosmos - 16. provision-api-roles-cosmos - 17. provision-sql-nsg - 18. provision-vnet - 19. provision-privatelink-file-core-windows-net - 20. provision-sql-store - 21. provision-pe-subnet-files-pe - 22. provision-privatelink-database-windows-net - 23. provision-sql - 24. provision-pe-subnet-sql-pe - 25. provision-api-roles-sql - 26. provision-env-acr - 27. provision-env - 28. provision-privatelink-documents-azure-com - 29. provision-pe-subnet-cosmos-pe - 30. login-to-acr-env-acr - 31. push-prereq - 32. push-api - 33. provision-api-containerapp - 34. print-api-summary - 35. provision-sql-admin-identity - 36. provision-sql-admin-identity-roles-sql-store - 37. provision-azure-bicep-resources - 38. print-dashboard-url-env - 39. deploy - 40. deploy-api - 41. destroy-prereq - 42. destroy-azure-azure634f9 - 43. destroy - 44. diagnostics - 45. publish-prereq - 46. publish-azure634f9 - 47. publish - 48. publish-manifest - 49. push + 9. validate-build-only-container-references + 10. deploy-prereq + 11. build-api + 12. build + 13. validate-azure-login + 14. create-provisioning-context + 15. provision-api-identity + 16. provision-cosmos + 17. provision-api-roles-cosmos + 18. provision-sql-nsg + 19. provision-vnet + 20. provision-privatelink-file-core-windows-net + 21. provision-sql-store + 22. provision-pe-subnet-files-pe + 23. provision-privatelink-database-windows-net + 24. provision-sql + 25. provision-pe-subnet-sql-pe + 26. provision-api-roles-sql + 27. provision-env-acr + 28. provision-env + 29. provision-privatelink-documents-azure-com + 30. provision-pe-subnet-cosmos-pe + 31. login-to-acr-env-acr + 32. push-prereq + 33. push-api + 34. provision-api-containerapp + 35. print-api-summary + 36. provision-sql-admin-identity + 37. provision-sql-admin-identity-roles-sql-store + 38. provision-azure-bicep-resources + 39. print-dashboard-url-env + 40. deploy + 41. deploy-api + 42. destroy-prereq + 43. destroy-azure-azure634f9 + 44. destroy + 45. diagnostics + 46. publish-prereq + 47. publish-azure634f9 + 48. publish + 49. publish-manifest + 50. push DETAILED STEP ANALYSIS ====================== @@ -113,7 +114,7 @@ Step: deploy-api Step: deploy-prereq Description: Prerequisite step that runs before any deploy operations. Initializes deployment environment and manages deployment state. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: destroy Description: Aggregation step for all destroy operations. All destroy steps should be required by this step. @@ -293,7 +294,7 @@ Step: publish-manifest Step: publish-prereq Description: Prerequisite step that runs before any publish operations. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: push Description: Aggregation step for all push operations. All push steps should be required by this step. @@ -316,6 +317,10 @@ Step: validate-azure-login Dependencies: ✓ deploy-prereq Resource: azure634f9 (AzureEnvironmentResource) +Step: validate-build-only-container-references + Description: Validates that build-only containers are consumed by another resource before publish or deploy. + Dependencies: none + Step: validate-compute-environments Description: Validates compute resource bindings before startup. Dependencies: none @@ -347,18 +352,18 @@ If targeting 'before-start': If targeting 'build': Direct dependencies: build-api - Total steps: 6 + Total steps: 7 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api [3] build If targeting 'build-api': Direct dependencies: build-prereq, check-container-runtime, deploy-prereq - Total steps: 5 + Total steps: 6 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api @@ -377,18 +382,18 @@ If targeting 'check-container-runtime': If targeting 'create-provisioning-context': Direct dependencies: deploy-prereq, validate-azure-login - Total steps: 4 + Total steps: 5 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context If targeting 'deploy': Direct dependencies: build-api, create-provisioning-context, print-api-summary, print-dashboard-url-env, provision-azure-bicep-resources, validate-azure-login - Total steps: 33 + Total steps: 34 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -404,9 +409,9 @@ If targeting 'deploy': If targeting 'deploy-api': Direct dependencies: print-api-summary - Total steps: 29 + Total steps: 30 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -420,10 +425,10 @@ If targeting 'deploy-api': [11] deploy-api If targeting 'deploy-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq If targeting 'destroy': @@ -455,9 +460,9 @@ If targeting 'diagnostics': If targeting 'login-to-acr-env-acr': Direct dependencies: provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -473,9 +478,9 @@ If targeting 'prepare-azure-container-apps-env': If targeting 'print-api-summary': Direct dependencies: provision-api-containerapp - Total steps: 28 + Total steps: 29 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -489,9 +494,9 @@ If targeting 'print-api-summary': If targeting 'print-dashboard-url-env': Direct dependencies: provision-azure-bicep-resources, provision-env - Total steps: 31 + Total steps: 32 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -512,9 +517,9 @@ If targeting 'process-parameters': If targeting 'provision-api-containerapp': Direct dependencies: create-provisioning-context, provision-api-identity, provision-api-roles-cosmos, provision-api-roles-sql, provision-cosmos, provision-env, provision-pe-subnet-cosmos-pe, provision-pe-subnet-sql-pe, provision-sql, push-api - Total steps: 27 + Total steps: 28 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -527,9 +532,9 @@ If targeting 'provision-api-containerapp': If targeting 'provision-api-identity': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -537,9 +542,9 @@ If targeting 'provision-api-identity': If targeting 'provision-api-roles-cosmos': Direct dependencies: create-provisioning-context, provision-api-identity, provision-cosmos - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -548,9 +553,9 @@ If targeting 'provision-api-roles-cosmos': If targeting 'provision-api-roles-sql': Direct dependencies: create-provisioning-context, provision-api-identity, provision-pe-subnet-files-pe, provision-pe-subnet-sql-pe, provision-sql, provision-sql-store, provision-vnet - Total steps: 14 + Total steps: 15 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -562,9 +567,9 @@ If targeting 'provision-api-roles-sql': If targeting 'provision-azure-bicep-resources': Direct dependencies: create-provisioning-context, deploy-prereq, provision-api-containerapp, provision-api-identity, provision-api-roles-cosmos, provision-api-roles-sql, provision-cosmos, provision-env, provision-env-acr, provision-pe-subnet-cosmos-pe, provision-pe-subnet-files-pe, provision-pe-subnet-sql-pe, provision-privatelink-database-windows-net, provision-privatelink-documents-azure-com, provision-privatelink-file-core-windows-net, provision-sql, provision-sql-admin-identity, provision-sql-admin-identity-roles-sql-store, provision-sql-nsg, provision-sql-store, provision-vnet - Total steps: 30 + Total steps: 31 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -578,9 +583,9 @@ If targeting 'provision-azure-bicep-resources': If targeting 'provision-cosmos': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -588,9 +593,9 @@ If targeting 'provision-cosmos': If targeting 'provision-env': Direct dependencies: create-provisioning-context, provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -599,9 +604,9 @@ If targeting 'provision-env': If targeting 'provision-env-acr': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -609,9 +614,9 @@ If targeting 'provision-env-acr': If targeting 'provision-pe-subnet-cosmos-pe': Direct dependencies: create-provisioning-context, provision-cosmos, provision-privatelink-documents-azure-com, provision-vnet - Total steps: 9 + Total steps: 10 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -622,9 +627,9 @@ If targeting 'provision-pe-subnet-cosmos-pe': If targeting 'provision-pe-subnet-files-pe': Direct dependencies: create-provisioning-context, provision-privatelink-file-core-windows-net, provision-sql-store, provision-vnet - Total steps: 9 + Total steps: 10 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -635,9 +640,9 @@ If targeting 'provision-pe-subnet-files-pe': If targeting 'provision-pe-subnet-sql-pe': Direct dependencies: create-provisioning-context, provision-privatelink-database-windows-net, provision-sql, provision-vnet - Total steps: 9 + Total steps: 10 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -648,9 +653,9 @@ If targeting 'provision-pe-subnet-sql-pe': If targeting 'provision-privatelink-database-windows-net': Direct dependencies: create-provisioning-context, provision-vnet - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -660,9 +665,9 @@ If targeting 'provision-privatelink-database-windows-net': If targeting 'provision-privatelink-documents-azure-com': Direct dependencies: create-provisioning-context, provision-vnet - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -672,9 +677,9 @@ If targeting 'provision-privatelink-documents-azure-com': If targeting 'provision-privatelink-file-core-windows-net': Direct dependencies: create-provisioning-context, provision-vnet - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -684,9 +689,9 @@ If targeting 'provision-privatelink-file-core-windows-net': If targeting 'provision-sql': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -694,9 +699,9 @@ If targeting 'provision-sql': If targeting 'provision-sql-admin-identity': Direct dependencies: create-provisioning-context, provision-sql - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -705,9 +710,9 @@ If targeting 'provision-sql-admin-identity': If targeting 'provision-sql-admin-identity-roles-sql-store': Direct dependencies: create-provisioning-context, provision-sql-admin-identity, provision-sql-store - Total steps: 8 + Total steps: 9 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -717,9 +722,9 @@ If targeting 'provision-sql-admin-identity-roles-sql-store': If targeting 'provision-sql-nsg': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -727,9 +732,9 @@ If targeting 'provision-sql-nsg': If targeting 'provision-sql-store': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -737,9 +742,9 @@ If targeting 'provision-sql-store': If targeting 'provision-vnet': Direct dependencies: create-provisioning-context, provision-sql-nsg - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -748,18 +753,18 @@ If targeting 'provision-vnet': If targeting 'publish': Direct dependencies: publish-azure634f9 - Total steps: 4 + Total steps: 5 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 [3] publish If targeting 'publish-azure634f9': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 @@ -770,17 +775,17 @@ If targeting 'publish-manifest': [0] publish-manifest If targeting 'publish-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq If targeting 'push': Direct dependencies: push-api, push-prereq - Total steps: 12 + Total steps: 13 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -792,9 +797,9 @@ If targeting 'push': If targeting 'push-api': Direct dependencies: build-api, push-prereq - Total steps: 11 + Total steps: 12 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -805,9 +810,9 @@ If targeting 'push-api': If targeting 'push-prereq': Direct dependencies: login-to-acr-env-acr - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -823,12 +828,18 @@ If targeting 'validate-azure-container-apps': If targeting 'validate-azure-login': Direct dependencies: deploy-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login +If targeting 'validate-build-only-container-references': + Direct dependencies: none + Total steps: 1 + Execution order: + [0] validate-build-only-container-references + If targeting 'validate-compute-environments': Direct dependencies: none Total steps: 1 @@ -836,4 +847,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt index 9a3c1a42fa4..d24abdad591 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt @@ -1,11 +1,11 @@ -[ +[ PIPELINE DEPENDENCY GRAPH DIAGNOSTICS ===================================== This diagnostic output shows the complete pipeline dependency graph structure. Use this to understand step relationships and troubleshoot execution issues. -Total steps defined: 44 +Total steps defined: 45 Analysis for full pipeline execution (showing all steps and their relationships) @@ -22,42 +22,43 @@ Steps with no dependencies run first, followed by steps that depend on them. 6. process-parameters 7. build-prereq 8. check-container-runtime - 9. deploy-prereq - 10. build-api - 11. build - 12. validate-azure-login - 13. create-provisioning-context - 14. provision-api-identity - 15. provision-cache-kv - 16. provision-api-roles-cache-kv - 17. provision-cosmos-kv - 18. provision-api-roles-cosmos-kv - 19. provision-pg-kv - 20. provision-api-roles-pg-kv - 21. provision-cache - 22. provision-cosmos - 23. provision-env-acr - 24. provision-env - 25. provision-pg - 26. login-to-acr-env-acr - 27. push-prereq - 28. push-api - 29. provision-api-website - 30. print-api-summary - 31. provision-azure-bicep-resources - 32. print-dashboard-url-env - 33. deploy - 34. deploy-api - 35. destroy-prereq - 36. destroy-azure-azure634f9 - 37. destroy - 38. diagnostics - 39. publish-prereq - 40. publish-azure634f9 - 41. validate-appservice-config-env - 42. publish - 43. publish-manifest - 44. push + 9. validate-build-only-container-references + 10. deploy-prereq + 11. build-api + 12. build + 13. validate-azure-login + 14. create-provisioning-context + 15. provision-api-identity + 16. provision-cache-kv + 17. provision-api-roles-cache-kv + 18. provision-cosmos-kv + 19. provision-api-roles-cosmos-kv + 20. provision-pg-kv + 21. provision-api-roles-pg-kv + 22. provision-cache + 23. provision-cosmos + 24. provision-env-acr + 25. provision-env + 26. provision-pg + 27. login-to-acr-env-acr + 28. push-prereq + 29. push-api + 30. provision-api-website + 31. print-api-summary + 32. provision-azure-bicep-resources + 33. print-dashboard-url-env + 34. deploy + 35. deploy-api + 36. destroy-prereq + 37. destroy-azure-azure634f9 + 38. destroy + 39. diagnostics + 40. publish-prereq + 41. publish-azure634f9 + 42. validate-appservice-config-env + 43. publish + 44. publish-manifest + 45. push DETAILED STEP ANALYSIS ====================== @@ -108,7 +109,7 @@ Step: deploy-api Step: deploy-prereq Description: Prerequisite step that runs before any deploy operations. Initializes deployment environment and manages deployment state. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: destroy Description: Aggregation step for all destroy operations. All destroy steps should be required by this step. @@ -252,7 +253,7 @@ Step: publish-manifest Step: publish-prereq Description: Prerequisite step that runs before any publish operations. - Dependencies: ✓ process-parameters + Dependencies: ✓ process-parameters, ✓ validate-build-only-container-references Step: push Description: Aggregation step for all push operations. All push steps should be required by this step. @@ -280,6 +281,10 @@ Step: validate-azure-login Dependencies: ✓ deploy-prereq Resource: azure634f9 (AzureEnvironmentResource) +Step: validate-build-only-container-references + Description: Validates that build-only containers are consumed by another resource before publish or deploy. + Dependencies: none + Step: validate-compute-environments Description: Validates compute resource bindings before startup. Dependencies: none @@ -311,18 +316,18 @@ If targeting 'before-start': If targeting 'build': Direct dependencies: build-api - Total steps: 6 + Total steps: 7 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api [3] build If targeting 'build-api': Direct dependencies: build-prereq, check-container-runtime, deploy-prereq - Total steps: 5 + Total steps: 6 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api @@ -341,18 +346,18 @@ If targeting 'check-container-runtime': If targeting 'create-provisioning-context': Direct dependencies: deploy-prereq, validate-azure-login - Total steps: 4 + Total steps: 5 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context If targeting 'deploy': Direct dependencies: build-api, create-provisioning-context, print-api-summary, print-dashboard-url-env, provision-azure-bicep-resources, validate-azure-login - Total steps: 27 + Total steps: 28 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -367,9 +372,9 @@ If targeting 'deploy': If targeting 'deploy-api': Direct dependencies: print-api-summary - Total steps: 25 + Total steps: 26 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -382,10 +387,10 @@ If targeting 'deploy-api': [10] deploy-api If targeting 'deploy-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq If targeting 'destroy': @@ -417,9 +422,9 @@ If targeting 'diagnostics': If targeting 'login-to-acr-env-acr': Direct dependencies: provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -435,9 +440,9 @@ If targeting 'prepare-azure-app-service-env': If targeting 'print-api-summary': Direct dependencies: provision-api-website - Total steps: 24 + Total steps: 25 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -450,9 +455,9 @@ If targeting 'print-api-summary': If targeting 'print-dashboard-url-env': Direct dependencies: provision-azure-bicep-resources, provision-env - Total steps: 25 + Total steps: 26 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -472,9 +477,9 @@ If targeting 'process-parameters': If targeting 'provision-api-identity': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -482,9 +487,9 @@ If targeting 'provision-api-identity': If targeting 'provision-api-roles-cache-kv': Direct dependencies: create-provisioning-context, provision-api-identity, provision-cache-kv - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -493,9 +498,9 @@ If targeting 'provision-api-roles-cache-kv': If targeting 'provision-api-roles-cosmos-kv': Direct dependencies: create-provisioning-context, provision-api-identity, provision-cosmos-kv - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -504,9 +509,9 @@ If targeting 'provision-api-roles-cosmos-kv': If targeting 'provision-api-roles-pg-kv': Direct dependencies: create-provisioning-context, provision-api-identity, provision-pg-kv - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -515,9 +520,9 @@ If targeting 'provision-api-roles-pg-kv': If targeting 'provision-api-website': Direct dependencies: create-provisioning-context, provision-api-identity, provision-api-roles-cache-kv, provision-api-roles-cosmos-kv, provision-api-roles-pg-kv, provision-cache, provision-cache-kv, provision-cosmos, provision-cosmos-kv, provision-env, provision-pg, provision-pg-kv, push-api - Total steps: 23 + Total steps: 24 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -529,9 +534,9 @@ If targeting 'provision-api-website': If targeting 'provision-azure-bicep-resources': Direct dependencies: create-provisioning-context, deploy-prereq, provision-api-identity, provision-api-roles-cache-kv, provision-api-roles-cosmos-kv, provision-api-roles-pg-kv, provision-api-website, provision-cache, provision-cache-kv, provision-cosmos, provision-cosmos-kv, provision-env, provision-env-acr, provision-pg, provision-pg-kv - Total steps: 24 + Total steps: 25 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -544,9 +549,9 @@ If targeting 'provision-azure-bicep-resources': If targeting 'provision-cache': Direct dependencies: create-provisioning-context, provision-cache-kv - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -555,9 +560,9 @@ If targeting 'provision-cache': If targeting 'provision-cache-kv': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -565,9 +570,9 @@ If targeting 'provision-cache-kv': If targeting 'provision-cosmos': Direct dependencies: create-provisioning-context, provision-cosmos-kv - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -576,9 +581,9 @@ If targeting 'provision-cosmos': If targeting 'provision-cosmos-kv': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -586,9 +591,9 @@ If targeting 'provision-cosmos-kv': If targeting 'provision-env': Direct dependencies: create-provisioning-context, provision-env-acr - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -597,9 +602,9 @@ If targeting 'provision-env': If targeting 'provision-env-acr': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -607,9 +612,9 @@ If targeting 'provision-env-acr': If targeting 'provision-pg': Direct dependencies: create-provisioning-context, provision-pg-kv - Total steps: 6 + Total steps: 7 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -618,9 +623,9 @@ If targeting 'provision-pg': If targeting 'provision-pg-kv': Direct dependencies: create-provisioning-context - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -628,18 +633,18 @@ If targeting 'provision-pg-kv': If targeting 'publish': Direct dependencies: publish-azure634f9, validate-appservice-config-env - Total steps: 5 + Total steps: 6 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 | validate-appservice-config-env (parallel) [3] publish If targeting 'publish-azure634f9': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] publish-azure634f9 @@ -650,17 +655,17 @@ If targeting 'publish-manifest': [0] publish-manifest If targeting 'publish-prereq': - Direct dependencies: process-parameters - Total steps: 2 + Direct dependencies: process-parameters, validate-build-only-container-references + Total steps: 3 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq If targeting 'push': Direct dependencies: push-api, push-prereq - Total steps: 12 + Total steps: 13 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -672,9 +677,9 @@ If targeting 'push': If targeting 'push-api': Direct dependencies: build-api, push-prereq - Total steps: 11 + Total steps: 12 Execution order: - [0] check-container-runtime | process-parameters (parallel) + [0] check-container-runtime | process-parameters | validate-build-only-container-references (parallel) [1] build-prereq | deploy-prereq (parallel) [2] build-api | validate-azure-login (parallel) [3] create-provisioning-context @@ -685,9 +690,9 @@ If targeting 'push-api': If targeting 'push-prereq': Direct dependencies: login-to-acr-env-acr - Total steps: 7 + Total steps: 8 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login [3] create-provisioning-context @@ -697,9 +702,9 @@ If targeting 'push-prereq': If targeting 'validate-appservice-config-env': Direct dependencies: publish-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] publish-prereq [2] validate-appservice-config-env @@ -711,12 +716,18 @@ If targeting 'validate-azure-app-service': If targeting 'validate-azure-login': Direct dependencies: deploy-prereq - Total steps: 3 + Total steps: 4 Execution order: - [0] process-parameters + [0] process-parameters | validate-build-only-container-references (parallel) [1] deploy-prereq [2] validate-azure-login +If targeting 'validate-build-only-container-references': + Direct dependencies: none + Total steps: 1 + Execution order: + [0] validate-build-only-container-references + If targeting 'validate-compute-environments': Direct dependencies: none Total steps: 1 @@ -724,4 +735,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file From 4fdb9e54aa5df760d4c8246e6633deb5d5c4d8cf Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 13:10:17 -0500 Subject: [PATCH 3/8] PR feedback Move DisableBuildOnlyContainerValidation to the Pipeline. --- ...DistributedApplicationBuilderExtensions.cs | 28 -------------- .../DistributedApplicationPipeline.cs | 2 +- ...istributedApplicationPipelineExtensions.cs | 38 +++++++++++++++++++ .../AzureDeployerTests.cs | 2 +- .../BuildOnlyContainerValidationTests.cs | 4 +- 5 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs diff --git a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs index 1c3c000524b..84251ca6b27 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs @@ -1,11 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable ASPIREPIPELINES001 - using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; -using Aspire.Hosting.Pipelines; namespace Aspire.Hosting; @@ -111,30 +108,5 @@ public static bool TryCreateResourceBuilder(this IDistributedApplicationBuild return true; } - /// - /// Disables the publish and deploy validation that requires build-only containers to be consumed by another resource. - /// - /// The distributed application builder. - /// The distributed application builder for chaining. - /// - /// This is an application-wide escape hatch for scenarios where the build-only container validation is too restrictive - /// for a particular app. Prefer wiring build-only containers through PublishWithContainerFiles or - /// PublishWithStaticFiles when possible. - /// - [AspireExport(Description = "Disables publish and deploy validation for unconsumed build-only containers.")] - [Experimental("ASPIREPIPELINES001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] - public static IDistributedApplicationBuilder DisableBuildOnlyContainerValidation(this IDistributedApplicationBuilder builder) - { - ArgumentNullException.ThrowIfNull(builder); - - builder.Pipeline.AddPipelineConfiguration(static context => - { - var validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); - validationStep.RequiredBySteps.Clear(); - return Task.CompletedTask; - }); - - return builder; - } } diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs index 5ed871da812..cc85d62bfa5 100644 --- a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs @@ -450,7 +450,7 @@ private static void ValidateBuildOnlyContainerReferences(DistributedApplicationM var resourceNames = string.Join("', '", unconsumedBuildOnlyContainers.Select(resource => resource.Name)); throw new DistributedApplicationException( $"Build-only container resource(s) '{resourceNames}' are not consumed by another resource and won't participate in publish or deploy. " + - $"Reference them from another resource using 'PublishWithContainerFiles' or 'PublishWithStaticFiles', or suppress this validation for the app by calling 'builder.DisableBuildOnlyContainerValidation()'."); + $"Reference them from another resource, for example using 'PublishWithContainerFiles' or 'PublishWithStaticFiles', or suppress this validation for the app by calling 'builder.Pipeline.DisableBuildOnlyContainerValidation()'."); } } diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs new file mode 100644 index 00000000000..e9a49c478b9 --- /dev/null +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics.CodeAnalysis; + +namespace Aspire.Hosting.Pipelines; + +/// +/// Extension methods for . +/// +[Experimental("ASPIREPIPELINES001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] +public static class DistributedApplicationPipelineExtensions +{ + /// + /// Disables the publish and deploy validation that requires build-only containers to be consumed by another resource. + /// + /// The distributed application pipeline. + /// The distributed application pipeline for chaining. + /// + /// This is an application-wide escape hatch for scenarios where the build-only container validation is too restrictive + /// for a particular app. Prefer wiring build-only containers through PublishWithContainerFiles or + /// PublishWithStaticFiles when possible. + /// + [AspireExport(Description = "Disables publish and deploy validation for unconsumed build-only containers.")] + public static IDistributedApplicationPipeline DisableBuildOnlyContainerValidation(this IDistributedApplicationPipeline pipeline) + { + ArgumentNullException.ThrowIfNull(pipeline); + + pipeline.AddPipelineConfiguration(static context => + { + var validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); + validationStep.RequiredBySteps.Clear(); + return Task.CompletedTask; + }); + + return pipeline; + } +} diff --git a/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs b/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs index 7430e184a5b..f74ebfcd137 100644 --- a/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs +++ b/tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs @@ -158,7 +158,7 @@ public async Task DeployAsync_WithBuildOnlyContainers() }; }); ConfigureTestServices(builder, armClientProvider: armClientProvider, activityReporter: mockActivityReporter); - builder.DisableBuildOnlyContainerValidation(); + builder.Pipeline.DisableBuildOnlyContainerValidation(); var containerAppEnv = builder.AddAzureContainerAppEnvironment("env"); diff --git a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs index d2ab5eea167..978e584274b 100644 --- a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs +++ b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs @@ -28,7 +28,7 @@ public async Task PublishPrereq_WithUnconsumedBuildOnlyContainer_Throws() Assert.Contains("'frontend'", ex.Message); Assert.Contains("PublishWithContainerFiles", ex.Message); - Assert.Contains("DisableBuildOnlyContainerValidation", ex.Message); + Assert.Contains("builder.Pipeline.DisableBuildOnlyContainerValidation", ex.Message); } [Fact] @@ -66,7 +66,7 @@ public async Task PublishPrereq_WithValidationDisabled_DoesNotThrow() using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.PublishPrereq); PipelineStep? validationStep = null; - builder.DisableBuildOnlyContainerValidation(); + builder.Pipeline.DisableBuildOnlyContainerValidation(); builder.Pipeline.AddPipelineConfiguration(context => { validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); From eea1853cdd0659c977211f537414a6ffe5e3ab67 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 13:18:54 -0500 Subject: [PATCH 4/8] PR feedback --- .../Pipelines/DistributedApplicationPipelineExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs index e9a49c478b9..f706245b5b8 100644 --- a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs @@ -28,8 +28,8 @@ public static IDistributedApplicationPipeline DisableBuildOnlyContainerValidatio pipeline.AddPipelineConfiguration(static context => { - var validationStep = context.Steps.Single(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); - validationStep.RequiredBySteps.Clear(); + var validationStep = context.Steps.SingleOrDefault(step => step.Name == DistributedApplicationPipeline.ValidateBuildOnlyContainerReferencesStepName); + validationStep?.RequiredBySteps.Clear(); return Task.CompletedTask; }); From d02eef1a71fb064f82187816552a57ea7382484f Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 14:03:59 -0500 Subject: [PATCH 5/8] Fix tests --- ...TwoPassScanningGeneratedAspire.verified.go | 12 ++++++++++ ...oPassScanningGeneratedAspire.verified.java | 7 ++++++ ...TwoPassScanningGeneratedAspire.verified.py | 9 ++++++++ ...TwoPassScanningGeneratedAspire.verified.rs | 9 ++++++++ ...TwoPassScanningGeneratedAspire.verified.ts | 22 +++++++++++++++++++ 5 files changed, 59 insertions(+) diff --git a/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go b/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go index df102d0f896..dd7c42a8898 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go +++ b/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go @@ -10149,6 +10149,18 @@ func NewIDistributedApplicationPipeline(handle *Handle, client *AspireClient) *I } } +// DisableBuildOnlyContainerValidation disables publish and deploy validation for unconsumed build-only containers. +func (s *IDistributedApplicationPipeline) DisableBuildOnlyContainerValidation() (*IDistributedApplicationPipeline, error) { + reqArgs := map[string]any{ + "pipeline": SerializeValue(s.Handle()), + } + result, err := s.Client().InvokeCapability("Aspire.Hosting/disableBuildOnlyContainerValidation", reqArgs) + if err != nil { + return nil, err + } + return result.(*IDistributedApplicationPipeline), nil +} + // AddStep adds a pipeline step to the application func (s *IDistributedApplicationPipeline) AddStep(stepName string, callback func(...any) any, dependsOn []string, requiredBy []string) error { reqArgs := map[string]any{ diff --git a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java index 3efb0f95a8f..ca24cbdfb2b 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java +++ b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java @@ -12001,6 +12001,13 @@ public class IDistributedApplicationPipeline extends HandleWrapperBase { super(handle, client); } + /** Disables publish and deploy validation for unconsumed build-only containers. */ + public IDistributedApplicationPipeline disableBuildOnlyContainerValidation() { + Map reqArgs = new HashMap<>(); + reqArgs.put("pipeline", AspireClient.serializeValue(getHandle())); + return (IDistributedApplicationPipeline) getClient().invokeCapability("Aspire.Hosting/disableBuildOnlyContainerValidation", reqArgs); + } + /** Adds a pipeline step to the application */ public void addStep(String stepName, AspireAction1 callback, AddStepOptions options) { var dependsOn = options == null ? null : options.getDependsOn(); diff --git a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py index 989c53c47da..7473caa8027 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py +++ b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py @@ -2368,6 +2368,15 @@ def handle(self) -> Handle: """The underlying object reference handle.""" return self._handle + def disable_build_only_container_validation(self) -> AbstractDistributedApplicationPipeline: + """Disables publish and deploy validation for unconsumed build-only containers.""" + rpc_args: dict[str, typing.Any] = {'pipeline': self._handle} + result = self._client.invoke_capability( + 'Aspire.Hosting/disableBuildOnlyContainerValidation', + rpc_args, + ) + return typing.cast(AbstractDistributedApplicationPipeline, result) + def add_step(self, step_name: str, callback: typing.Callable[[PipelineStepContext], None], *, depends_on: typing.Iterable[str] | None = None, required_by: typing.Iterable[str] | None = None) -> None: """Adds a pipeline step to the application""" rpc_args: dict[str, typing.Any] = {'pipeline': self._handle} diff --git a/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs b/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs index 579ab8666d6..e7c6f0f0575 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs +++ b/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs @@ -9218,6 +9218,15 @@ impl IDistributedApplicationPipeline { &self.client } + /// Disables publish and deploy validation for unconsumed build-only containers. + pub fn disable_build_only_container_validation(&self) -> Result> { + let mut args: HashMap = HashMap::new(); + args.insert("pipeline".to_string(), self.handle.to_json()); + let result = self.client.invoke_capability("Aspire.Hosting/disableBuildOnlyContainerValidation", args)?; + let handle: Handle = serde_json::from_value(result)?; + Ok(IDistributedApplicationPipeline::new(handle, self.client.clone())) + } + /// Adds a pipeline step to the application pub fn add_step(&self, step_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, depends_on: Option>, required_by: Option>) -> Result<(), Box> { let mut args: HashMap = HashMap::new(); diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts index 3b02b64a29a..8754c0d76da 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts @@ -6285,6 +6285,8 @@ class DistributedApplicationEventingPromiseImpl implements DistributedApplicatio export interface DistributedApplicationPipeline { toJSON(): MarshalledHandle; + /** Disables publish and deploy validation for unconsumed build-only containers. */ + disableBuildOnlyContainerValidation(): DistributedApplicationPipelinePromise; /** Adds a pipeline step to the application */ addStep(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: AddStepOptions): DistributedApplicationPipelinePromise; /** Configures the application pipeline via a callback */ @@ -6292,6 +6294,8 @@ export interface DistributedApplicationPipeline { } export interface DistributedApplicationPipelinePromise extends PromiseLike { + /** Disables publish and deploy validation for unconsumed build-only containers. */ + disableBuildOnlyContainerValidation(): DistributedApplicationPipelinePromise; /** Adds a pipeline step to the application */ addStep(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: AddStepOptions): DistributedApplicationPipelinePromise; /** Configures the application pipeline via a callback */ @@ -6311,6 +6315,20 @@ class DistributedApplicationPipelineImpl implements DistributedApplicationPipeli /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return this._handle.toJSON(); } + /** @internal */ + async _disableBuildOnlyContainerValidationInternal(): Promise { + const rpcArgs: Record = { pipeline: this._handle }; + const result = await this._client.invokeCapability( + 'Aspire.Hosting/disableBuildOnlyContainerValidation', + rpcArgs + ); + return new DistributedApplicationPipelineImpl(result, this._client); + } + + disableBuildOnlyContainerValidation(): DistributedApplicationPipelinePromise { + return new DistributedApplicationPipelinePromiseImpl(this._disableBuildOnlyContainerValidationInternal(), this._client); + } + /** @internal */ async _addStepInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[]): Promise { const callbackId = registerCallback(async (argData: unknown) => { @@ -6370,6 +6388,10 @@ class DistributedApplicationPipelinePromiseImpl implements DistributedApplicatio return this._promise.then(onfulfilled, onrejected); } + disableBuildOnlyContainerValidation(): DistributedApplicationPipelinePromise { + return new DistributedApplicationPipelinePromiseImpl(this._promise.then(obj => obj.disableBuildOnlyContainerValidation()), this._client); + } + addStep(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: AddStepOptions): DistributedApplicationPipelinePromise { return new DistributedApplicationPipelinePromiseImpl(this._promise.then(obj => obj.addStep(stepName, callback, options)), this._client); } From 983d9bff82e78b17c52462ce6ffdf7715abab02c Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 17:56:22 -0500 Subject: [PATCH 6/8] Address build-only container validation feedback Ensure manifest publishing runs the build-only container validation step and strengthen tests to cover mixed consumed and unconsumed build-only containers. --- .../DistributedApplicationBuilder.cs | 2 +- .../DistributedApplicationPipeline.cs | 2 +- .../ManifestPublishingExtensions.cs | 4 ++- ..._DoesNotHang_step=diagnostics.verified.txt | 11 ++++---- ...nments_Works_step=diagnostics.verified.txt | 11 ++++---- ...ts_CreatesCorrectDependencies.verified.txt | 11 ++++---- ...on_CreatesCorrectDependencies.verified.txt | 11 ++++---- .../BuildOnlyContainerValidationTests.cs | 28 +++++++++++++++++-- 8 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/Aspire.Hosting/DistributedApplicationBuilder.cs b/src/Aspire.Hosting/DistributedApplicationBuilder.cs index 9a27861ea11..797a74d2b4a 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilder.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilder.cs @@ -676,7 +676,7 @@ private void ConfigurePipelineOptions(DistributedApplicationOptions options) // If no explicit --step was provided, set it to run only the manifest step if (string.IsNullOrEmpty(_innerBuilder.Configuration["Pipeline:Step"])) { - _innerBuilder.Configuration["Pipeline:Step"] = "publish-manifest"; + _innerBuilder.Configuration["Pipeline:Step"] = ManifestPublishingExtensions.PublishManifestStepName; } // If no explicit operation was set, default to Publish mode diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs index cc85d62bfa5..6c9bfdcf132 100644 --- a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs @@ -321,7 +321,7 @@ public DistributedApplicationPipeline() ValidateBuildOnlyContainerReferences(context.Model); return Task.CompletedTask; }, - RequiredBySteps = [WellKnownPipelineSteps.PublishPrereq, WellKnownPipelineSteps.DeployPrereq], + RequiredBySteps = [WellKnownPipelineSteps.PublishPrereq, WellKnownPipelineSteps.DeployPrereq, ManifestPublishingExtensions.PublishManifestStepName], }); // Add diagnostic step for dependency graph analysis diff --git a/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs b/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs index d72b939fdc1..66e810ae595 100644 --- a/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs +++ b/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs @@ -16,6 +16,8 @@ namespace Aspire.Hosting.Publishing; /// internal static class ManifestPublishingExtensions { + internal const string PublishManifestStepName = "publish-manifest"; + /// /// Adds a step to the pipeline that publishes an Aspire manifest file. /// @@ -26,7 +28,7 @@ public static IDistributedApplicationPipeline AddManifestPublishing(this IDistri { var step = new PipelineStep { - Name = "publish-manifest", + Name = PublishManifestStepName, Description = "Publishes the Aspire application model as a JSON manifest file.", Action = async context => { diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt index 6721d545ce8..7ccc51c9054 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt @@ -200,7 +200,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: none + Dependencies: ✓ validate-build-only-container-references Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -525,10 +525,11 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: none - Total steps: 1 + Direct dependencies: validate-build-only-container-references + Total steps: 2 Execution order: - [0] publish-manifest + [0] validate-build-only-container-references + [1] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -611,4 +612,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] \ No newline at end of file +] diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt index c80d16eb9bc..586a8a58eb5 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt @@ -269,7 +269,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: none + Dependencies: ✓ validate-build-only-container-references Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -728,10 +728,11 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: none - Total steps: 1 + Direct dependencies: validate-build-only-container-references + Total steps: 2 Execution order: - [0] publish-manifest + [0] validate-build-only-container-references + [1] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -833,4 +834,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] \ No newline at end of file +] diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt index e2ab85d8610..3c297799811 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt @@ -290,7 +290,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: none + Dependencies: ✓ validate-build-only-container-references Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -769,10 +769,11 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: none - Total steps: 1 + Direct dependencies: validate-build-only-container-references + Total steps: 2 Execution order: - [0] publish-manifest + [0] validate-build-only-container-references + [1] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -847,4 +848,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] \ No newline at end of file +] diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt index d24abdad591..1e824e560d6 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt @@ -249,7 +249,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: none + Dependencies: ✓ validate-build-only-container-references Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -649,10 +649,11 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: none - Total steps: 1 + Direct dependencies: validate-build-only-container-references + Total steps: 2 Execution order: - [0] publish-manifest + [0] validate-build-only-container-references + [1] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -735,4 +736,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] \ No newline at end of file +] diff --git a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs index 978e584274b..540d9b0477e 100644 --- a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs +++ b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs @@ -4,6 +4,7 @@ #pragma warning disable ASPIREPIPELINES001 using Aspire.Hosting.Pipelines; +using Aspire.Hosting.Publishing; using Aspire.Hosting.Utils; using Microsoft.AspNetCore.InternalTesting; using Microsoft.Extensions.DependencyInjection; @@ -19,14 +20,18 @@ public async Task PublishPrereq_WithUnconsumedBuildOnlyContainer_Throws() { using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.PublishPrereq); - AddBuildOnlyContainer(builder, "frontend"); + var consumed = AddBuildOnlyContainer(builder, "frontend"); + AddBuildOnlyContainer(builder, "orphan"); + builder.AddResource(new TestContainerFilesDestinationResource("api")) + .PublishWithContainerFiles(consumed, "/app/wwwroot"); using var app = builder.Build(); var ex = await Assert.ThrowsAsync( () => ExecutePipelineAsync(app)).DefaultTimeout(); - Assert.Contains("'frontend'", ex.Message); + Assert.Contains("'orphan'", ex.Message); + Assert.DoesNotContain("'frontend'", ex.Message); Assert.Contains("PublishWithContainerFiles", ex.Message); Assert.Contains("builder.Pipeline.DisableBuildOnlyContainerValidation", ex.Message); } @@ -36,6 +41,25 @@ public async Task DeployPrereq_WithUnconsumedBuildOnlyContainer_Throws() { using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: WellKnownPipelineSteps.DeployPrereq); + var consumed = AddBuildOnlyContainer(builder, "frontend"); + AddBuildOnlyContainer(builder, "orphan"); + builder.AddResource(new TestContainerFilesDestinationResource("api")) + .PublishWithContainerFiles(consumed, "/app/wwwroot"); + + using var app = builder.Build(); + + var ex = await Assert.ThrowsAsync( + () => ExecutePipelineAsync(app)).DefaultTimeout(); + + Assert.Contains("'orphan'", ex.Message); + Assert.DoesNotContain("'frontend'", ex.Message); + } + + [Fact] + public async Task PublishManifest_WithUnconsumedBuildOnlyContainer_Throws() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: ManifestPublishingExtensions.PublishManifestStepName); + AddBuildOnlyContainer(builder, "frontend"); using var app = builder.Build(); From 4ba6c6b4d4b170b241885e8d60d9773f96d31ab3 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 18:16:09 -0500 Subject: [PATCH 7/8] Revert publish-manifest changes. --- .../DistributedApplicationBuilder.cs | 2 +- .../Pipelines/DistributedApplicationPipeline.cs | 2 +- .../Publishing/ManifestPublishingExtensions.cs | 4 +--- ...ies_DoesNotHang_step=diagnostics.verified.txt | 11 +++++------ ...ironments_Works_step=diagnostics.verified.txt | 11 +++++------ ...oints_CreatesCorrectDependencies.verified.txt | 11 +++++------ ...ation_CreatesCorrectDependencies.verified.txt | 11 +++++------ .../BuildOnlyContainerValidationTests.cs | 16 ---------------- 8 files changed, 23 insertions(+), 45 deletions(-) diff --git a/src/Aspire.Hosting/DistributedApplicationBuilder.cs b/src/Aspire.Hosting/DistributedApplicationBuilder.cs index 797a74d2b4a..9a27861ea11 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilder.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilder.cs @@ -676,7 +676,7 @@ private void ConfigurePipelineOptions(DistributedApplicationOptions options) // If no explicit --step was provided, set it to run only the manifest step if (string.IsNullOrEmpty(_innerBuilder.Configuration["Pipeline:Step"])) { - _innerBuilder.Configuration["Pipeline:Step"] = ManifestPublishingExtensions.PublishManifestStepName; + _innerBuilder.Configuration["Pipeline:Step"] = "publish-manifest"; } // If no explicit operation was set, default to Publish mode diff --git a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs index 6c9bfdcf132..cc85d62bfa5 100644 --- a/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs +++ b/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs @@ -321,7 +321,7 @@ public DistributedApplicationPipeline() ValidateBuildOnlyContainerReferences(context.Model); return Task.CompletedTask; }, - RequiredBySteps = [WellKnownPipelineSteps.PublishPrereq, WellKnownPipelineSteps.DeployPrereq, ManifestPublishingExtensions.PublishManifestStepName], + RequiredBySteps = [WellKnownPipelineSteps.PublishPrereq, WellKnownPipelineSteps.DeployPrereq], }); // Add diagnostic step for dependency graph analysis diff --git a/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs b/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs index 66e810ae595..d72b939fdc1 100644 --- a/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs +++ b/src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs @@ -16,8 +16,6 @@ namespace Aspire.Hosting.Publishing; /// internal static class ManifestPublishingExtensions { - internal const string PublishManifestStepName = "publish-manifest"; - /// /// Adds a step to the pipeline that publishes an Aspire manifest file. /// @@ -28,7 +26,7 @@ public static IDistributedApplicationPipeline AddManifestPublishing(this IDistri { var step = new PipelineStep { - Name = PublishManifestStepName, + Name = "publish-manifest", Description = "Publishes the Aspire application model as a JSON manifest file.", Action = async context => { diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt index 7ccc51c9054..6721d545ce8 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithAzureResourceDependencies_DoesNotHang_step=diagnostics.verified.txt @@ -200,7 +200,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: ✓ validate-build-only-container-references + Dependencies: none Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -525,11 +525,10 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: validate-build-only-container-references - Total steps: 2 + Direct dependencies: none + Total steps: 1 Execution order: - [0] validate-build-only-container-references - [1] publish-manifest + [0] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -612,4 +611,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt index 586a8a58eb5..c80d16eb9bc 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works_step=diagnostics.verified.txt @@ -269,7 +269,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: ✓ validate-build-only-container-references + Dependencies: none Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -728,11 +728,10 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: validate-build-only-container-references - Total steps: 2 + Direct dependencies: none + Total steps: 1 Execution order: - [0] validate-build-only-container-references - [1] publish-manifest + [0] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -834,4 +833,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt index 3c297799811..e2ab85d8610 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithPrivateEndpoints_CreatesCorrectDependencies.verified.txt @@ -290,7 +290,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: ✓ validate-build-only-container-references + Dependencies: none Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -769,11 +769,10 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: validate-build-only-container-references - Total steps: 2 + Direct dependencies: none + Total steps: 1 Execution order: - [0] validate-build-only-container-references - [1] publish-manifest + [0] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -848,4 +847,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt index 1e824e560d6..d24abdad591 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureDeployerTests.DeployAsync_WithRedisAccessKeyAuthentication_CreatesCorrectDependencies.verified.txt @@ -249,7 +249,7 @@ Step: publish-azure634f9 Step: publish-manifest Description: Publishes the Aspire application model as a JSON manifest file. - Dependencies: ✓ validate-build-only-container-references + Dependencies: none Step: publish-prereq Description: Prerequisite step that runs before any publish operations. @@ -649,11 +649,10 @@ If targeting 'publish-azure634f9': [2] publish-azure634f9 If targeting 'publish-manifest': - Direct dependencies: validate-build-only-container-references - Total steps: 2 + Direct dependencies: none + Total steps: 1 Execution order: - [0] validate-build-only-container-references - [1] publish-manifest + [0] publish-manifest If targeting 'publish-prereq': Direct dependencies: process-parameters, validate-build-only-container-references @@ -736,4 +735,4 @@ If targeting 'validate-compute-environments': [0] validate-compute-environments -] +] \ No newline at end of file diff --git a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs index 540d9b0477e..f0e1a5dbbd6 100644 --- a/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs +++ b/tests/Aspire.Hosting.Tests/BuildOnlyContainerValidationTests.cs @@ -4,7 +4,6 @@ #pragma warning disable ASPIREPIPELINES001 using Aspire.Hosting.Pipelines; -using Aspire.Hosting.Publishing; using Aspire.Hosting.Utils; using Microsoft.AspNetCore.InternalTesting; using Microsoft.Extensions.DependencyInjection; @@ -55,21 +54,6 @@ public async Task DeployPrereq_WithUnconsumedBuildOnlyContainer_Throws() Assert.DoesNotContain("'frontend'", ex.Message); } - [Fact] - public async Task PublishManifest_WithUnconsumedBuildOnlyContainer_Throws() - { - using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, step: ManifestPublishingExtensions.PublishManifestStepName); - - AddBuildOnlyContainer(builder, "frontend"); - - using var app = builder.Build(); - - var ex = await Assert.ThrowsAsync( - () => ExecutePipelineAsync(app)).DefaultTimeout(); - - Assert.Contains("'frontend'", ex.Message); - } - [Fact] public async Task PublishPrereq_WithConsumedBuildOnlyContainer_DoesNotThrow() { From cced3e0ccfc1391ff22d7c0b2b3b04930afc4a1a Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 29 Apr 2026 18:28:45 -0500 Subject: [PATCH 8/8] Apply suggestion from @eerhardt --- src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs index 84251ca6b27..94b31924943 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilderExtensions.cs @@ -107,6 +107,5 @@ public static bool TryCreateResourceBuilder(this IDistributedApplicationBuild resourceBuilder = builder.CreateResourceBuilder(typedResource); return true; } - }