Skip to content

Use Ubuntu 24.04 Noble Numbat images by default starting in 8.0.300 #39614

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public sealed class ComputeDotnetBaseImageAndTag : Microsoft.Build.Utilities.Tas
public ITaskItem[] FrameworkReferences { get; set; }

/// <summary>
/// If this is set to linux-ARCH then we use jammy-chiseled for the AOT/Extra/etc decisions.
/// If this is set to linux-ARCH then we use noble-chiseled for the AOT/Extra/etc decisions.
/// If this is set to linux-musl-ARCH then we need to use `alpine` for all containers, and tag on `aot` or `extra` as necessary.
/// </summary>
[Required]
Expand All @@ -65,7 +65,7 @@ public sealed class ComputeDotnetBaseImageAndTag : Microsoft.Build.Utilities.Tas

/// <summary>
/// If set, this expresses a preference for a variant of the container image that we infer for a project.
/// e.g. 'alpine', or 'jammy-chiseled'
/// e.g. 'alpine', or 'noble-chiseled'
/// </summary>
public string ContainerFamily { get; set; }

Expand Down Expand Up @@ -105,10 +105,23 @@ public override bool Execute()
return !Log.HasLoggedErrors;
}

private string UbuntuCodenameForSDKVersion(SemanticVersion version)
{
if (version >= SemanticVersion.Parse("8.0.300"))
{
return "noble";
}
else
{
return "jammy";
}
}

private bool ComputeRepositoryAndTag([NotNullWhen(true)] out string? repository, [NotNullWhen(true)] out string? tag)
{
if (ComputeVersionPart() is (string baseVersionPart, SemanticVersion parsedVersion, bool versionAllowsUsingAOTAndExtrasImages))
{
var defaultUbuntuVersion = UbuntuCodenameForSDKVersion(parsedVersion);
Log.LogMessage("Computed base version tag of {0} from TFM {1} and SDK {2}", baseVersionPart, TargetFrameworkVersion, SdkVersion);
if (baseVersionPart is null)
{
Expand Down Expand Up @@ -139,7 +152,7 @@ private bool ComputeRepositoryAndTag([NotNullWhen(true)] out string? repository,
// in question, and the app is globalized, we can help and add -extra so the app will actually run

if (
(!IsMuslRid && ContainerFamily == "jammy-chiseled") // default for linux RID
(!IsMuslRid && ContainerFamily.EndsWith("-chiseled")) // default for linux RID
&& !UsesInvariantGlobalization
&& versionAllowsUsingAOTAndExtrasImages
// the extras only became available on the stable tags of the FirstVersionWithNewTaggingScheme
Expand Down Expand Up @@ -170,8 +183,8 @@ private bool ComputeRepositoryAndTag([NotNullWhen(true)] out string? repository,
{
true => "-alpine",
// default to chiseled for AOT, non-musl Apps
false when IsAotPublished || IsTrimmed => "-jammy-chiseled", // TODO: should we default here to jammy-chiseled for non-musl RIDs?
// default to jammy for non-AOT, non-musl Apps
false when IsAotPublished || IsTrimmed => $"-{defaultUbuntuVersion}-chiseled", // TODO: should we default here to noble-chiseled for non-musl RIDs?
// default to noble for non-AOT, non-musl Apps
false => ""
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ public void WindowsUsersGetLinuxContainers(string sdkPortableRid, string expecte
[InlineData("8.0.100-preview.2", "v8.0", "jammy-chiseled", "8.0.0-preview.2-jammy-chiseled")]
[InlineData("8.0.100-rc.2", "v8.0", "jammy-chiseled", "8.0.0-rc.2-jammy-chiseled")]
[InlineData("8.0.100", "v8.0", "jammy-chiseled", "8.0-jammy-chiseled-extra")]
[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")]
[Theory]
public void CanTakeContainerBaseFamilyIntoAccount(string sdkVersion, string tfmMajMin, string containerFamily, string expectedTag)
{
Expand Down Expand Up @@ -349,13 +352,13 @@ public void AOTAppsGetAOTImages(string rid, string expectedImage)
}

[InlineData("linux-musl-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine-extra")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled-extra")]
[Theory]
public void AOTAppsWithCulturesGetExtraImages(string rid, string expectedImage)
{
var (project, logger, d) = ProjectInitializer.InitProject(new()
{
["NetCoreSdkVersion"] = "8.0.100",
["NetCoreSdkVersion"] = "8.0.300",
["TargetFrameworkVersion"] = "v8.0",
[KnownStrings.Properties.ContainerRuntimeIdentifier] = rid,
[KnownStrings.Properties.PublishSelfContained] = true.ToString(),
Expand All @@ -370,13 +373,13 @@ public void AOTAppsWithCulturesGetExtraImages(string rid, string expectedImage)
}

[InlineData("linux-musl-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine-extra")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled-extra")]
[Theory]
public void TrimmedAppsWithCulturesGetExtraImages(string rid, string expectedImage)
{
var (project, logger, d) = ProjectInitializer.InitProject(new()
{
["NetCoreSdkVersion"] = "8.0.100",
["NetCoreSdkVersion"] = "8.0.300",
["TargetFrameworkVersion"] = "v8.0",
[KnownStrings.Properties.ContainerRuntimeIdentifier] = rid,
[KnownStrings.Properties.PublishSelfContained] = true.ToString(),
Expand All @@ -391,13 +394,13 @@ public void TrimmedAppsWithCulturesGetExtraImages(string rid, string expectedIma
}

[InlineData("linux-musl-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled")]
[InlineData("linux-x64", "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled")]
[Theory]
public void TrimmedAppsWithoutCulturesGetbaseImages(string rid, string expectedImage)
{
var (project, logger, d) = ProjectInitializer.InitProject(new()
{
["NetCoreSdkVersion"] = "8.0.100",
["NetCoreSdkVersion"] = "8.0.300",
["TargetFrameworkVersion"] = "v8.0",
[KnownStrings.Properties.ContainerRuntimeIdentifier] = rid,
[KnownStrings.Properties.PublishSelfContained] = true.ToString(),
Expand All @@ -416,16 +419,16 @@ public void TrimmedAppsWithoutCulturesGetbaseImages(string rid, string expectedI
[InlineData(false, true, "linux-musl-x64", true, "mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0-alpine-aot")]
[InlineData(false, true, "linux-musl-x64", false, "mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine-extra")]

[InlineData(true, false, "linux-x64", true, "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled")]
[InlineData(true, false, "linux-x64", false, "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra")]
[InlineData(false, true, "linux-x64", true, "mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0-jammy-chiseled-aot")]
[InlineData(false, true, "linux-x64", false, "mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra")]
[InlineData(true, false, "linux-x64", true, "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled")]
[InlineData(true, false, "linux-x64", false, "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled-extra")]
[InlineData(false, true, "linux-x64", true, "mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0-noble-chiseled-aot")]
[InlineData(false, true, "linux-x64", false, "mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled-extra")]
[Theory]
public void TheBigMatrixOfTrimmingInference(bool trimmed, bool aot, string rid, bool invariant, string expectedImage)
{
var (project, logger, d) = ProjectInitializer.InitProject(new()
{
["NetCoreSdkVersion"] = "8.0.100",
["NetCoreSdkVersion"] = "8.0.300",
["TargetFrameworkVersion"] = "v8.0",
[KnownStrings.Properties.ContainerRuntimeIdentifier] = rid,
[KnownStrings.Properties.PublishSelfContained] = true.ToString(),
Expand Down