Skip to content

Conversation

max2020204
Copy link

Description

  • This PR refactors the WithContainerFiles extension method:
  • Removes the conditional branch between RunMode and PublishMode.
  • Always uses ContainerFileSystemCallbackAnnotation to copy files into the container instead of falling back to WithBindMount during publish.
  • Simplifies code and ensures consistency across run and publish scenarios.
  • Prevents runtime errors when publishing to Kubernetes where bind mounts are not supported.

This change was motivated by issues reported when using WithRealmImport for Keycloak. In publish mode, the method was creating a bind mount which caused the Kubernetes publisher to fail with:

Bind mounts are not supported by the Kubernetes publisher

Fixes # (issue)

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
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copy link
Contributor

github-actions bot commented Sep 8, 2025

🚀 Dogfood this PR with:

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11285

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11285"

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 8, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 8, 2025
@davidfowl
Copy link
Member

I dont' think we'd take this change unless we somehow unified everything on container files and made them work everywhere.

@max2020204
Copy link
Author

I dont' think we'd take this change unless we somehow unified everything on container files and made them work everywhere.

Can you explain what the problem with this solution?

@davidfowl
Copy link
Member

This doesn't solve any problems it just deletes container files/bind mounts from being used in publish mode. The intent of the original changes was to support bind mounts where possible in publish mode, not to ignore them.

If we decide to take this change, I would expect to see an implementation of evaluating container files in publish mode for k8s, docker compose and the azure compute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants