Fix Ubuntu codename resolution for .NET 11#53371
Fix Ubuntu codename resolution for .NET 11#53371hwoodiwiss wants to merge 4 commits intodotnet:release/11.0.1xx-preview4from
Conversation
Updates ubuntu codename resolution to take into account the change from noble to resolute. This should fix SDK container builds for .NET 11. Fixes dotnet#53370
|
Hey @hwoodiwiss, thanks for the contribution, sorry we missed this for Preview 3! We'll get it in for Preview 4. I'm going to take over this PR and get it merged. Hopefully I can refactor this soon so that manual updates aren't required here (or aren't required as frequently). |
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK container base-image inference logic to use the new Ubuntu codename (resolute) for .NET 11, aiming to fix container builds that currently resolve to the wrong runtime-deps tag.
Changes:
- Update Ubuntu codename selection to return
resolutefor .NET 11 SDK versions. - Add/adjust integration test cases to cover .NET 11 container-family/tag expectations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs | Adds new InlineData cases for .NET 11-related tag/image expectations. |
| src/Containers/Microsoft.NET.Build.Containers/Tasks/ComputeDotnetBaseImageAndTag.cs | Updates Ubuntu codename inference to introduce resolute for .NET 11. |
| [InlineData("8.0.300", "v8.0", "noble-chiseled", "8.0-noble-chiseled-extra")] | ||
| [InlineData("8.0.300", "v8.0", "jammy-chiseled", "8.0-jammy-chiseled-extra")] | ||
| [InlineData("11.0.100-preview.2", "v11.0", "resolute-chiseled", "11.0.0-preview.2-resolute-chiseled-extra")] | ||
| [InlineData("11.0.100", "v11.0", "resolute", "11.0-resolute-chiseled")] |
There was a problem hiding this comment.
containerFamily is set to "resolute", but the expected tag ends with "resolute-chiseled". In the current implementation, when ContainerFamily is provided it is appended verbatim (no implicit -chiseled is added), so this case should either pass "resolute-chiseled" as the family or update the expected tag to end with "11.0-resolute".
| [InlineData("11.0.100", "v11.0", "resolute", "11.0-resolute-chiseled")] | |
| [InlineData("11.0.100", "v11.0", "resolute", "11.0-resolute")] |
| if (version >= SemanticVersion.Parse("11.0.100")) | ||
| { | ||
| return "resolute"; | ||
| } |
There was a problem hiding this comment.
The new resolute codename mapping isn’t covered by a test that exercises the default Ubuntu codename inference path (i.e., with ContainerFamily unset and an AOT/trimmed publish that forces -{codename}-chiseled). The InlineData added here only tests explicit ContainerFamily strings, which bypasses UbuntuCodenameForSDKVersion. Please add/extend an integration test case (e.g., for 11.0.100-preview.2) that validates the inferred tag uses resolute rather than noble.
| if (version >= SemanticVersion.Parse("11.0.100")) | ||
| { | ||
| return "resolute"; | ||
| } | ||
| else if (version >= SemanticVersion.Parse("8.0.300")) | ||
| { | ||
| return "noble"; | ||
| } |
There was a problem hiding this comment.
UbuntuCodenameForSDKVersion uses version >= SemanticVersion.Parse("11.0.100"), which will not match prerelease SDK versions like 11.0.100-preview.2 (prereleases compare lower than the corresponding stable version). That means .NET 11 preview builds will still resolve to noble, so this change won’t fix the reported container tag issue. Consider switching the check to something that includes prereleases (e.g., version.Major >= 11 or comparing against 11.0.100-preview.1).
| [InlineData("8.0.200", "v8.0", "jammy-chiseled", "8.0-jammy-chiseled-extra")] | ||
| [InlineData("8.0.300", "v8.0", "noble-chiseled", "8.0-noble-chiseled-extra")] | ||
| [InlineData("8.0.300", "v8.0", "jammy-chiseled", "8.0-jammy-chiseled-extra")] | ||
| [InlineData("11.0.100-preview.2", "v11.0", "resolute-chiseled", "11.0.0-preview.2-resolute-chiseled-extra")] |
There was a problem hiding this comment.
This prerelease InlineData expects an -extra suffix (11.0.0-preview.2-...-extra), but the tagging logic in ComputeDotnetBaseImageAndTag intentionally avoids auto-adding -extra for prerelease tags when the user explicitly sets ContainerFamily (it gates -extra behind !parsedVersion.IsPrerelease). As written, this test case will fail unless the product logic is also changed.
| [InlineData("11.0.100-preview.2", "v11.0", "resolute-chiseled", "11.0.0-preview.2-resolute-chiseled-extra")] | |
| [InlineData("11.0.100-preview.2", "v11.0", "resolute-chiseled", "11.0.0-preview.2-resolute-chiseled")] |
Updates ubuntu codename resolution to take into account the change from noble to resolute. This should fix SDK container builds for .NET 11.
Fixes #53370