@@ -41,19 +41,31 @@ type windowsOSVersion struct {
4141const (
4242 // rs5 (version 1809, codename "Redstone 5") corresponds to Windows Server
4343 // 2019 (ltsc2019), and Windows 10 (October 2018 Update).
44- rs5 = 17763
44+ RS5 = 17763
45+ // LTSC2019 (Windows Server 2019) is an alias for [RS5].
46+ LTSC2019 = RS5
4547
46- // v21H2Server corresponds to Windows Server 2022 (ltsc2022).
47- v21H2Server = 20348
48+ // V21H2Server corresponds to Windows Server 2022 (ltsc2022).
49+ V21H2Server = 20348
50+ // LTSC2022 (Windows Server 2022) is an alias for [V21H2Server]
51+ LTSC2022 = V21H2Server
4852
49- // v22H2Win11 corresponds to Windows 11 (2022 Update).
50- v22H2Win11 = 22621
53+ // V22H2Win11 corresponds to Windows 11 (2022 Update).
54+ V22H2Win11 = 22621
55+
56+ // V23H2 is the 23H2 release in the Windows Server annual channel.
57+ V23H2 = 25398
58+
59+ // Windows Server 2025 build 26100
60+ V25H1Server = 26100
61+ LTSC2025 = V25H1Server
5162)
5263
5364// List of stable ABI compliant ltsc releases
5465// Note: List must be sorted in ascending order
5566var compatLTSCReleases = []uint16 {
56- v21H2Server ,
67+ LTSC2022 ,
68+ LTSC2025 ,
5769}
5870
5971// CheckHostAndContainerCompat checks if given host and container
@@ -70,18 +82,27 @@ func checkWindowsHostAndContainerCompat(host, ctr windowsOSVersion) bool {
7082 }
7183
7284 // If host is < WS 2022, exact version match is required
73- if host .Build < v21H2Server {
85+ if host .Build < LTSC2022 {
7486 return host .Build == ctr .Build
7587 }
7688
77- var supportedLtscRelease uint16
89+ // Find the latest LTSC version that is earlier than the host version.
90+ // This is the earliest version of container that the host can run.
91+ //
92+ // If the host version is an LTSC, then it supports compatibility with
93+ // everything from the previous LTSC up to itself, so we want supportedLTSCRelease
94+ // to be the previous entry.
95+ //
96+ // If no match is found, then we know that the host is LTSC2022 exactly,
97+ // since we already checked that it's not less than LTSC2022.
98+ var supportedLTSCRelease uint16 = LTSC2022
7899 for i := len (compatLTSCReleases ) - 1 ; i >= 0 ; i -- {
79- if host .Build >= compatLTSCReleases [i ] {
80- supportedLtscRelease = compatLTSCReleases [i ]
100+ if host .Build > compatLTSCReleases [i ] {
101+ supportedLTSCRelease = compatLTSCReleases [i ]
81102 break
82103 }
83104 }
84- return ctr . Build >= supportedLtscRelease && ctr .Build <= host .Build
105+ return supportedLTSCRelease <= ctr . Build && ctr .Build <= host .Build
85106}
86107
87108func getWindowsOSVersion (osVersionPrefix string ) windowsOSVersion {
0 commit comments