-
Notifications
You must be signed in to change notification settings - Fork 806
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Partially related to #12703
We have some additional environment variables that depend on each other:
DOCKER_REGISTRY_HOSTNAME=registry.myhost.com
MIRRORS_DOCKER_REPOSITORY=${DOCKER_REGISTRY_HOSTNAME}/devops/container-images/mirrors/
ASPIRE_DOCKER_REPOSITORY=${MIRRORS_DOCKER_REPOSITORY}aspire-dashboard
Due to EnvFile using SortedDictionary<string, EnvEntry>, the loaded lines get out of order. ASPIRE_DOCKER_REPOSITORY will be on top before MIRRORS_DOCKER_REPOSITORY is declared, leading to an error on startup.
Expected Behavior
At least when already loading the existing file (publish-compose), make sure to not mess up the existing file. On prepare-compose, it's not loaded and just freshly written either way, which sadly blocks us from using it in the first place due to not being able to get sorting in there. But this would at least unblock publish-compse for us. Right now, we manually merge the changes to be able to at least manually start our environment.
Sadly DockerComposeEnvironmentResource.AddEnvironmentVariable is only reachable through DockerComposeServiceExtensions.AsEnvironmentPlaceholder, so it's not possible to just add our variables to the environment. If DockerComposeEnvironmentResource would offer to add self-defined environment variables directly AND have the SortedDictionary being replaced by a Dictionary, prepare-compose would also start working.
This sadly makes usage of most aspire do commands unusable. We COULD avoid using composed values, but this would make the generated docker-compose file less flexible for quick manipulation on customer systems.
Steps To Reproduce
- Create an Aspire project using environment variables
- Add the above mentioned variables
- Call
aspire do publish-compose - Check the sorting in
.env
Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 10.0.103
Commit: c2435c3e0f
Workload version: 10.0.100-manifests.a62d7899
MSBuild version: 18.0.11+c2435c3e0
Runtime Environment:
OS Name: Mac OS X
OS Version: 26.3
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/10.0.103/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.3
Architecture: arm64
Commit: c2435c3e0f
.NET SDKs installed:
9.0.311 [/usr/local/share/dotnet/sdk]
10.0.103 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_INSTALL_DIR [/usr/local/share/dotnet/]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Anything else?
Aspire version: 13.1.1