Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Description

Backport of #13576 to release/13.1, modified to remove ContainerImageDestination API dependencies not present in this branch.

Changes

  • Container runtime check in BuildImageAsync: Added runtime health check for individual resource builds to catch issues early in single-image scenarios
  • Improved error messages: Include container runtime name (docker/podman) in error logs and exceptions for better diagnostics
  • Simplified logic: Removed ContainerImageDestination-dependent optimizations that relied on APIs not available in release/13.1

The runtime check logic reverts to the original approach: check if resources use Docker format or lack output paths, without attempting to detect Archive destinations.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Removed Destination property from ResolvedContainerBuildOptions
- Reverted ResourcesRequireContainerRuntimeAsync to original logic
- Removed 5 tests that used ContainerImageDestination enum
- Reverted FakeContainerRuntime test helper changes
- Kept error message improvements with container runtime name

Co-authored-by: captainsafia <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • eastus.data.mcr.microsoft.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet publish /home/REDACTED/work/aspire/aspire/tests/testproject/TestProject.ServiceA/TestProject.ServiceA.csproj --configuration Release /t:PublishContainer /p:ContainerRepository=servicea /p:ContainerImageTag=latest /p:ContainerArchiveOutputPath=/tmp/test-path /p:ContainerImageFormat=OCI /p:RuntimeIdentifier=linux-x64 /p:ContainerRuntimeIdentifier=linux-x64 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix skip container runtime check for Archive destinations [release/13.1] Fix: Skip container runtime check for Archive destinations and improve error messages Dec 16, 2025
Copilot AI requested a review from captainsafia December 16, 2025 00:42
@captainsafia captainsafia marked this pull request as ready for review December 16, 2025 00:43
@captainsafia captainsafia merged commit bfed158 into backport/pr-13576-to-release/13.1 Dec 16, 2025
2 of 3 checks passed
@captainsafia captainsafia deleted the copilot/sub-pr-13579 branch December 16, 2025 00:43
joperezr pushed a commit that referenced this pull request Dec 16, 2025
…image builds (#13579)

* Initial plan

* Implement fix for container runtime check with Archive destinations

- Updated ResourcesRequireContainerRuntimeAsync to skip runtime check for resources with Archive destination
- Added runtime check to BuildImageAsync for Dockerfile resources
- Updated FakeContainerRuntime test helper to support isRunning parameter
- Added tests to verify the behavior (3 of 4 passing, 1 test needs refinement)

Co-authored-by: captainsafia <[email protected]>

* Fix ResourcesRequireContainerRuntimeAsync to maintain backward compatibility

Reordered logic to check Dockerfile resources first, then Archive destination, preserving the original behavior for OCI + OutputPath combinations.

Co-authored-by: captainsafia <[email protected]>

* Address PR feedback: optimize runtime checks and move to BuildImageAsync

- Move container runtime check to beginning of BuildImageAsync for all resource types
- Optimize ResourcesRequireContainerRuntimeAsync to call ResolveContainerBuildOptionsAsync once
- Only check Destination when OutputPath is present to avoid unnecessary callback

Co-authored-by: captainsafia <[email protected]>

* Add Destination to ResolvedContainerBuildOptions to avoid recomputing

- Added Destination property to ResolvedContainerBuildOptions class
- Set Destination in ResolveContainerBuildOptionsAsync from context
- Use Destination directly in ResourcesRequireContainerRuntimeAsync instead of calling ProcessContainerBuildOptionsCallbackAsync again
- Simplifies logic and avoids redundant callback invocations

Co-authored-by: captainsafia <[email protected]>

* Include container runtime name in error messages

- Updated error log and exception messages to include container runtime name
- Changed from "Container runtime is not running" to "Container runtime '{name}' is not running"
- Updated test assertions to match new error message format
- Improves error diagnostics by showing which runtime (docker/podman) is being checked

Co-authored-by: captainsafia <[email protected]>

* [release/13.1] Fix: Skip container runtime check for Archive destinations and improve error messages (#13580)

* Initial plan

* Remove ContainerImageDestination related parts as requested

- Removed Destination property from ResolvedContainerBuildOptions
- Reverted ResourcesRequireContainerRuntimeAsync to original logic
- Removed 5 tests that used ContainerImageDestination enum
- Reverted FakeContainerRuntime test helper changes
- Kept error message improvements with container runtime name

Co-authored-by: captainsafia <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: captainsafia <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: captainsafia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants