-
Notifications
You must be signed in to change notification settings - Fork 739
Fix deployment state file case sensitivity issue on Linux #13103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When loading deployment state, the environment name was not normalized to lowercase, causing a mismatch with the saved state file on case-sensitive file systems (Linux/macOS). FileDeploymentStateManager saves files with lowercase environment names (e.g., production.json), but LoadDeploymentState in DistributedApplicationBuilder was using the original casing (e.g., Production.json), causing cache loading to fail unless the exact casing was specified with --environment flag. Changes: - Normalized environment name to lowercase in LoadDeploymentState method - Updated test to use lowercase filename to match actual behavior Fixes the issue where aspire deploy would only work with explicit --environment production flag on Linux.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13103Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13103" |
davidfowl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change right?
There was a problem hiding this 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 fixes a case sensitivity bug in deployment state file caching on Linux and macOS systems. The bug occurred because FileDeploymentStateManager saves state files with lowercase environment names (using .ToLowerInvariant()), but DistributedApplicationBuilder.LoadDeploymentState was using the original casing from EnvironmentName, causing file lookups to fail on case-sensitive filesystems.
Key Changes
- Fixed: Added
.ToLowerInvariant()normalization inLoadDeploymentStateto matchFileDeploymentStateManagerbehavior - Corrected test: Updated test filename from
Production.jsontoproduction.jsonto reflect actual runtime behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Hosting/DistributedApplicationBuilder.cs | Applied .ToLowerInvariant() to environment name when constructing deployment state path, ensuring consistency with file save logic |
| tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs | Corrected test filename to use lowercase production.json matching the actual file system behavior |
I don't think so. Looks more like a bug-fix to me 🤔 (for linux). In windows you can't have |
|
@vhvb1989 I suspect there is another place where this is an issue. I could reproduce the problem on Debian 12 and workaround with |
Description
Fixes #13102 - a case sensitivity bug in deployment state file caching on Linux and macOS systems that prevented
aspire deployfrom loading cached deployment state unless an explicit--environmentflag with the exact casing was provided.Problem
When running
aspire deployon Linux/macOS, the deployment state cache was not being loaded properly due to a case mismatch in environment name handling:FileDeploymentStateManagersaves state files with lowercase environment names (e.g.,production.json)DistributedApplicationBuilder.LoadDeploymentStatewas using the original casing fromEnvironmentName(e.g.,Production.json)Since Linux and macOS filesystems are case-sensitive, this caused cache loading to fail silently. The deployment would work only when explicitly specifying
aspire deploy --environment production(lowercase).Solution
Normalized the environment name to lowercase in
LoadDeploymentStatemethod using.ToLowerInvariant()to match the behavior inFileDeploymentStateManager.GetStatePath().Changes
.ToLowerInvariant()to environment name when constructing deployment state pathproduction.jsoninstead ofProduction.jsonto reflect actual behaviorTesting
DeployAsync_WithCachedDeploymentState_LoadsFromCachepasses with updated filenameFileDeploymentStateManager.GetStatePath()implementationDeployAsync_WithStagingEnvironment_UsesStagingStateFilealready uses lowercasestaging.jsonMicrosoft Reviewers: Open in CodeFlow