Skip to content

Conversation

@captainsafia
Copy link
Member

Closes #10156.

Before:

image

After:

image

Copilot AI review requested due to automatic review settings July 14, 2025 22:26
@captainsafia captainsafia requested a review from mitchdenny as a code owner July 14, 2025 22:26
@github-actions github-actions bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jul 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures the container image build step fails fast with a clear exception when the container runtime is not running or is unhealthy, and adds a corresponding unit test.

  • Changed the builder to throw an InvalidOperationException instead of silently returning when the runtime check fails.
  • Added a test (BuildImageAsync_ThrowsInvalidOperationException_WhenDockerRuntimeNotAvailable) to verify both the exception and log output in an unhealthy-runtime scenario.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Hosting.Tests/Publishing/ResourceContainerImageBuilderTests.cs Added test for unhealthy container runtime to assert exception and log
src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs Switched from return to throwing an exception on runtime failure
Comments suppressed due to low confidence (1)

tests/Aspire.Hosting.Tests/Publishing/ResourceContainerImageBuilderTests.cs:386

  • [nitpick] The test method name references BuildImageAsync but calls BuildImagesAsync; consider renaming to BuildImagesAsync_ThrowsInvalidOperationException_WhenDockerRuntimeNotAvailable for consistency.
    public async Task BuildImageAsync_ThrowsInvalidOperationException_WhenDockerRuntimeNotAvailable()

@captainsafia captainsafia enabled auto-merge (squash) July 14, 2025 22:39
@captainsafia
Copy link
Member Author

/backport to release/9.4

@github-actions
Copy link
Contributor

Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16279438927

@captainsafia captainsafia merged commit fc66a25 into main Jul 14, 2025
276 of 277 checks passed
@captainsafia captainsafia deleted the safia/imgbuilder-exception branch July 14, 2025 22:43
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing the container image build does not stop the publish/deployment

3 participants