Skip to content

Fix Ubuntu codename resolution for .NET 11#53371

Open
hwoodiwiss wants to merge 4 commits intodotnet:release/11.0.1xx-preview4from
hwoodiwiss:hw-fix-ubuntu-codename
Open

Fix Ubuntu codename resolution for .NET 11#53371
hwoodiwiss wants to merge 4 commits intodotnet:release/11.0.1xx-preview4from
hwoodiwiss:hw-fix-ubuntu-codename

Conversation

@hwoodiwiss
Copy link
Copy Markdown
Contributor

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

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
@github-actions github-actions Bot added the Area-Containers Related to dotnet SDK containers functionality label Mar 11, 2026
@lbussell
Copy link
Copy Markdown
Member

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).

Copilot AI review requested due to automatic review settings April 20, 2026 18:54
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 resolute for .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")]
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Suggested change
[InlineData("11.0.100", "v11.0", "resolute", "11.0-resolute-chiseled")]
[InlineData("11.0.100", "v11.0", "resolute", "11.0-resolute")]

Copilot uses AI. Check for mistakes.
Comment on lines +146 to +149
if (version >= SemanticVersion.Parse("11.0.100"))
{
return "resolute";
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +146 to 153
if (version >= SemanticVersion.Parse("11.0.100"))
{
return "resolute";
}
else if (version >= SemanticVersion.Parse("8.0.300"))
{
return "noble";
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
[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")]
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
[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")]

Copilot uses AI. Check for mistakes.
@lbussell lbussell changed the base branch from main to release/11.0.1xx-preview4 April 24, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Containers Related to dotnet SDK containers functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Ubuntu Codename selected for .NET 11 builds

3 participants