Throw if container runtime is unhealthy during image build#10399
Merged
captainsafia merged 1 commit intomainfrom Jul 14, 2025
Merged
Throw if container runtime is unhealthy during image build#10399captainsafia merged 1 commit intomainfrom
captainsafia merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
InvalidOperationExceptioninstead 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()
eerhardt
approved these changes
Jul 14, 2025
Contributor
Author
|
/backport to release/9.4 |
Contributor
|
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16279438927 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10156.
Before:
After: