Skip to content

Commit 9d06aef

Browse files
authored
Merge remote-tracking branch 'origin/main' into copilot/fix-image-builder-host-management
# Conflicts: # src/ImageBuilder/ImageBuilder.cs
2 parents 29e27b4 + d51d6ad commit 9d06aef

38 files changed

Lines changed: 761 additions & 364 deletions

eng/docker-tools/DEV-GUIDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,28 @@ The stages variable is useful for:
198198
- Skipping tests during initial development
199199
- Running isolated stages for debugging
200200

201+
### Decoupling build OS from the base image OS
202+
203+
By default, a platform's `osVersion` represents the base image OS version, but also determines what
204+
build leg an image is built in. This can cause problems when build image and base image don't match
205+
up. For example, building a .NET app on Windows Server 2025 and copying the artifacts into a
206+
Windows Server 2019 base image won't work, because the build matrix generation will attempt to
207+
build the image on the Server 2019 build leg (which can't run Server 2025 images).
208+
209+
To fix this, set the optional `buildOsVersion` field in order to override only the OS used in the
210+
build matrix generation. Here is an example of building a Windows Server 2019 image using Windows
211+
Server 2025:
212+
213+
```jsonc
214+
{
215+
// ...
216+
"os": "windows",
217+
"osVersion": "windowsservercore-ltsc2019",
218+
"buildOsVersion": "windowsservercore-ltsc2025"
219+
// ...
220+
}
221+
```
222+
201223
### Image Info Files: The Build's Memory
202224

203225
Image info files (defined by [`ImageArtifactDetails`](https://github.com/dotnet/docker-tools/blob/main/src/ImageBuilder/Models/Image/ImageArtifactDetails.cs)) are the mechanism that tracks what was built:

eng/pipelines/renovate.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Renovate Dependency Update Pipeline
2+
# This pipeline runs Renovate to automatically create PRs for dependency updates.
3+
14
trigger: none
25
pr: none
36

@@ -21,16 +24,13 @@ parameters:
2124
default: false
2225

2326
variables:
24-
- template: /eng/docker-tools/templates/variables/sdl-pool.yml@self
27+
- name: gitHubRepo
28+
value: 'dotnet/docker-tools'
2529

2630
extends:
27-
template: /eng/docker-tools/templates/1es.yml@self
31+
template: /eng/common/core-templates/stages/renovate.yml@self
2832
parameters:
29-
stages:
30-
- stage: Renovate
31-
jobs:
32-
- template: /eng/pipelines/templates/jobs/renovate.yml
33-
parameters:
34-
gitHubRepo: dotnet/docker-tools
35-
dryRun: ${{ parameters.dryRun }}
36-
forceRecreatePR: ${{ parameters.forceRecreatePR }}
33+
dryRun: ${{ parameters.dryRun }}
34+
forceRecreatePR: ${{ parameters.forceRecreatePR }}
35+
gitHubRepo: ${{ variables.gitHubRepo }}
36+
renovateConfigPath: eng/renovate.json

eng/pipelines/templates/jobs/renovate.yml

Lines changed: 0 additions & 125 deletions
This file was deleted.

eng/renovate.env

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/ImageBuilder.Models/Manifest/OS.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
namespace Microsoft.DotNet.ImageBuilder.Models.Manifest;
66

7+
/// <summary>
8+
/// The generic operating system family of an image. Serialized to the manifest as a lowercase
9+
/// string (e.g. "linux", "windows"). The specific OS version is captured separately by
10+
/// <see cref="Platform.OsVersion"/> (e.g. "azurelinux3.0", "windowsservercore-ltsc2025").
11+
/// </summary>
712
public enum OS
813
{
914
Linux,

src/ImageBuilder.Models/Manifest/Platform.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,32 @@ public class Platform
4141
public string? DockerfileTemplate { get; set; }
4242

4343
[Description(
44-
"The generic name of the operating system associated with the image."
44+
"The generic name of the operating system associated with the image. " +
45+
"Examples: linux, windows."
4546
)]
4647
[JsonConverter(typeof(StringEnumConverter))]
4748
[JsonProperty(Required = Required.Always)]
4849
public OS OS { get; set; }
4950

5051
[Description(
51-
"The specific version of the operating system associated with the image. " +
52-
"Examples: alpine3.9, bionic, nanoserver-1903."
52+
"The specific version of the operating system that this platform targets. This is " +
53+
"metadata used to filter which platforms are built (--os-version), recorded in the " +
54+
"image-info output, used to derive the OS display name in generated readmes, and " +
55+
"(unless overridden by BuildOsVersion) to select the build host." +
56+
"Examples: alpine3.2X, jammy, noble, trixie, nanoserver-1809, nanoserver-ltsc2025, " +
57+
"windowsservercore-ltsc2025."
5358
)]
5459
[JsonProperty(Required = Required.Always)]
5560
public string OsVersion { get; set; } = string.Empty;
5661

62+
[Description(
63+
"Overrides the operating system version used to select the build host/agent without " +
64+
"affecting the --os-version filter or image-info. This allows platforms that target " +
65+
"different OS versions to be built together on a single build host. Uses the same value " +
66+
"format as OsVersion. When omitted, the build host is selected based on OsVersion."
67+
)]
68+
public string? BuildOsVersion { get; set; }
69+
5770
[Description(
5871
"The set of platform-specific tags associated with the image."
5972
)]

0 commit comments

Comments
 (0)