Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Oct 31, 2025

Backport of #12310 to release/13.0

/cc @captainsafia @copilot

Customer Impact

This is a regression from the last release. When updating environment variables in .env files with onlyIfMissing: false, duplicate key entries are generated in the file instead of updating the existing key. This causes invalid .env files with multiple definitions of the same variable and breaks Docker container configuration.

Testing

Unit tests and manual validation.

Risk

Low. The fix refactors key parsing into a reusable TryParseKey method and adds logic to update existing key values in-place when onlyIfMissing: false. The change is localized to the EnvFile.Add method and maintains backward compatibility for the onlyIfMissing: true case.

Regression?

Yes - this fixes a regression where duplicate keys were created in .env files.

@github-actions
Copy link
Contributor Author

github-actions bot commented Oct 31, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

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

Or

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

@joperezr joperezr added the Servicing-approved Approved for servicing release label Oct 31, 2025
@davidfowl davidfowl enabled auto-merge (squash) November 1, 2025 03:24
@davidfowl davidfowl merged commit 899b529 into release/13.0 Nov 1, 2025
295 of 296 checks passed
@davidfowl davidfowl deleted the backport/pr-12310-to-release/13.0 branch November 1, 2025 03:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants