Skip to content
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

Enable testing of internal stable-versioned servicing builds #6022

Merged
merged 1 commit into from
Nov 4, 2024
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
26 changes: 20 additions & 6 deletions eng/Get-DropVersions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,22 @@ function GetVersionInfoFromBuildId([string]$buildId) {

$isStableVersion = Get-IsStableBranding -Version $config.Sdk_Builds[0]

return [PSCustomObject]@{
DockerfileVersion = $config.Channel
SdkVersion = @($config.Sdks | Sort-Object -Descending)[0]
RuntimeVersion = $config.Runtime
AspnetVersion = $config.Asp
StableBranding = $isStableVersion
if ($UseInternalBuild) {
return [PSCustomObject]@{
DockerfileVersion = $config.Channel
SdkVersion = @($config.Sdk_Builds | Sort-Object -Descending)[0]
RuntimeVersion = $config.Runtime_Build
AspnetVersion = $config.Asp_Build
StableBranding = $isStableVersion
}
} else {
return [PSCustomObject]@{
DockerfileVersion = $config.Channel
SdkVersion = @($config.Sdks | Sort-Object -Descending)[0]
RuntimeVersion = $config.Runtime
AspnetVersion = $config.Asp
StableBranding = $isStableVersion
}
}
}
catch [System.Management.Automation.CommandNotFoundException] {
Expand Down Expand Up @@ -322,6 +332,10 @@ if ($UpdateDependencies)
Write-Host "ASP.NET Core version: $($versionInfo.AspnetVersion)"
Write-Host

if ($versionInfo.StableBranding) {
$additionalArgs += @{ UseStableBranding = $versionInfo.StableBranding }
}

$setVersionsScript = Join-Path $PSScriptRoot "Set-DotnetVersions.ps1"
& $setVersionsScript `
-ProductVersion $versionInfo.DockerfileVersion `
Expand Down
17 changes: 13 additions & 4 deletions eng/dockerfile-templates/aspnet/Dockerfile.envs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
{{
_ ARGS:
is-composite-runtime (optional): Whether to include the runtime version ^
is-composite-runtime (optional): Whether to include the runtime version
is-internal (optional): Whether the Dockerfile is targeting an internal build of the product ^

set dotnetVersion to join(slice(split(PRODUCT_VERSION, "."), 0, 2), ".") ^
set isWindows to find(OS_VERSION, "nanoserver") >= 0 || find(OS_VERSION, "windowsservercore") >= 0 ^
set isStableBranding to (find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-servicing") >= 0 ||
find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-rtm") >= 0) ^
set runtimeVersion to when(isStableBranding && ARGS["is-internal"],
VARIABLES[cat("dotnet|", dotnetVersion, "|product-version")],
VARIABLES[cat("runtime|", dotnetVersion, "|build-version")]) ^
set aspnetVersion to when(isStableBranding && ARGS["is-internal"],
VARIABLES[cat("dotnet|", dotnetVersion, "|product-version")],
VARIABLES[cat("aspnet|", dotnetVersion, "|build-version")]) ^
set lineContinuation to when(isWindows, "`", "\") ^
set aspnetComment to "# ASP.NET Core version"
}}{{if ARGS["is-composite-runtime"]:ENV {{lineContinuation}}
# .NET Runtime version
DOTNET_VERSION={{VARIABLES[cat("runtime|", dotnetVersion, "|build-version")]}} {{lineContinuation}}
DOTNET_VERSION={{runtimeVersion}} {{lineContinuation}}
{{aspnetComment}}
ASPNET_VERSION={{VARIABLES[cat("aspnet|", dotnetVersion, "|build-version")]}}
ASPNET_VERSION={{aspnetVersion}}
^else:{{aspnetComment}}
ENV ASPNET_VERSION={{VARIABLES[cat("aspnet|", dotnetVersion, "|build-version")]}}}}
ENV ASPNET_VERSION={{aspnetVersion}}}}
4 changes: 2 additions & 2 deletions eng/dockerfile-templates/aspnet/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{{if isAlpine:
{{InsertTemplate("../Dockerfile.alpine.invariant-mode")}}
}}
{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

# Install ASP.NET Core
{{InsertTemplate("Dockerfile.linux.install-aspnet",
Expand Down Expand Up @@ -81,7 +81,7 @@ RUN {{InsertTemplate("../Dockerfile.linux.install-pkgs",
# ASP.NET Core image
FROM {{runtimeBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}
{{if isInternal && isRpmInstall:
{{InsertTemplate("Dockerfile.linux.install-aspnet",
[
Expand Down
12 changes: 10 additions & 2 deletions eng/dockerfile-templates/aspnet/Dockerfile.linux-composite
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
{{ if isAlpine:
{{InsertTemplate("../Dockerfile.alpine.invariant-mode")}}
}}
{{InsertTemplate("Dockerfile.envs", [ "is-composite-runtime": "true" ])}}
{{InsertTemplate("Dockerfile.envs",
[
"is-composite-runtime": "true",
"is-internal": isInternal
])}}

# Install ASP.NET Composite Runtime
{{InsertTemplate("../runtime/Dockerfile.linux.install-runtime",
Expand Down Expand Up @@ -82,7 +86,11 @@ RUN mkdir /dotnet-symlink \
# ASP.NET Composite Image
FROM {{runtimeDepsBaseTag}}

{{InsertTemplate("Dockerfile.envs", [ "is-composite-runtime": "true" ])}}{{ if isDistroless:
{{InsertTemplate("Dockerfile.envs",
[
"is-composite-runtime": "true",
"is-internal": isInternal
])}}{{ if isDistroless:
COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"]
COPY --from=installer ["/dotnet-symlink", "/usr/bin"]

Expand Down
4 changes: 2 additions & 2 deletions eng/dockerfile-templates/aspnet/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARG REPO=mcr.microsoft.com/dotnet/runtime

}}FROM {{runtimeBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

{{InsertTemplate("Dockerfile.windows.install-aspnet")}}^else:
{{
Expand All @@ -38,6 +38,6 @@ ARG ACCESSTOKEN
# ASP.NET Core image
FROM {{runtimeBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

COPY --from=installer ["/dotnet/shared/Microsoft.AspNetCore.App", "/Program Files/dotnet/shared/Microsoft.AspNetCore.App"]}}
12 changes: 10 additions & 2 deletions eng/dockerfile-templates/runtime/Dockerfile.envs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{{
set dotnetVersion to join(slice(split(PRODUCT_VERSION, "."), 0, 2), ".")
_ ARGS:
is-internal (optional): Whether the Dockerfile is targeting an internal build of the product ^

set dotnetVersion to join(slice(split(PRODUCT_VERSION, "."), 0, 2), ".") ^
set isStableBranding to (find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-servicing") >= 0 ||
find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-rtm") >= 0) ^
set runtimeVersion to when(isStableBranding && ARGS["is-internal"],
VARIABLES[cat("dotnet|", dotnetVersion, "|product-version")],
VARIABLES[cat("runtime|", dotnetVersion, "|build-version")])
}}# .NET Runtime version
{{if INDENT ="":ENV }}DOTNET_VERSION={{VARIABLES[cat("runtime|", dotnetVersion, "|build-version")]}}
{{if INDENT ="":ENV }}DOTNET_VERSION={{runtimeVersion}}
4 changes: 2 additions & 2 deletions eng/dockerfile-templates/runtime/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _ SINGLE STAGE
{{if isAlpine:
{{InsertTemplate("../Dockerfile.alpine.invariant-mode")}}
}}
{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

# Install .NET Runtime
{{InsertTemplate("Dockerfile.linux.install-runtime",
Expand Down Expand Up @@ -86,7 +86,7 @@ RUN mkdir /dotnet-symlink \
# .NET runtime image
FROM {{runtimeDepsBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}
{{ if isInternal && isRpmInstall:
{{InsertTemplate("Dockerfile.linux.install-runtime",
[
Expand Down
4 changes: 2 additions & 2 deletions eng/dockerfile-templates/runtime/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}}FROM {{serverCoreBaseTag}}

{{InsertTemplate("../Dockerfile.common-dotnet-envs")}} `
{{InsertTemplate("Dockerfile.envs", [], " ")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal], " ")}}

# Install .NET Runtime
{{InsertTemplate("Dockerfile.windows.install-runtime")}}
Expand All @@ -42,7 +42,7 @@ ARG ACCESSTOKEN
FROM mcr.microsoft.com/windows/{{finalStageBaseRepo}}:{{OS_VERSION_NUMBER}}-amd64

{{InsertTemplate("../Dockerfile.common-dotnet-envs")}} `
{{InsertTemplate("Dockerfile.envs", [], " ")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal], " ")}}

{{InsertTemplate("../Dockerfile.windows.set-path", [ "path": "C:\Program Files\dotnet"])}}

Expand Down
10 changes: 9 additions & 1 deletion eng/dockerfile-templates/sdk/Dockerfile.envs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{{
_ ARGS:
is-internal (optional): Whether the Dockerfile is targeting an internal build of the product ^

set dotnetVersion to join(slice(split(PRODUCT_VERSION, "."), 0, 2), ".") ^
set isStableBranding to (find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-servicing") >= 0 ||
find(VARIABLES[cat("sdk|", dotnetVersion, "|build-version")], "-rtm") >= 0) ^
set sdkVersion to when(isStableBranding && ARGS["is-internal"],
VARIABLES[cat("sdk|", dotnetVersion, "|product-version")],
VARIABLES[cat("sdk|", dotnetVersion, "|build-version")]) ^
set isAlpine to find(OS_VERSION, "alpine") >= 0 ^
set isWindows to find(OS_VERSION, "nanoserver") >= 0 || find(OS_VERSION, "windowsservercore") >= 0 ^
set lineContinuation to when(isWindows, "`", "\")
Expand All @@ -11,7 +19,7 @@
# Do not show first run text
DOTNET_NOLOGO=true {{lineContinuation}}
# SDK version
DOTNET_SDK_VERSION={{VARIABLES[cat("sdk|", dotnetVersion, "|build-version")]}} {{lineContinuation}}{{if isAlpine:
DOTNET_SDK_VERSION={{sdkVersion}} {{lineContinuation}}{{if isAlpine:
# Disable the invariant mode (set in base image)
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false {{lineContinuation}}}}
# Enable correct mode for dotnet watch (only mode supported in a container)
Expand Down
2 changes: 1 addition & 1 deletion eng/dockerfile-templates/sdk/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ RUN {{InsertTemplate("../Dockerfile.linux.install-pkgs",
# .NET SDK image
}}FROM {{baseImageTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

RUN {{InsertTemplate("../Dockerfile.linux.install-pkgs",
[
Expand Down
4 changes: 2 additions & 2 deletions eng/dockerfile-templates/sdk/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARG REPO=mcr.microsoft.com/dotnet/aspnet

}}FROM {{aspnetBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

{{InsertTemplate("Dockerfile.windows.install-components")}}

Expand All @@ -50,7 +50,7 @@ ARG ACCESSTOKEN
# SDK image
FROM {{aspnetBaseTag}}

{{InsertTemplate("Dockerfile.envs")}}
{{InsertTemplate("Dockerfile.envs", ["is-internal": isInternal])}}

{{InsertTemplate("../Dockerfile.windows.set-path", [ "path": paths ])}}

Expand Down