@@ -41,19 +41,31 @@ type windowsOSVersion struct {
41
41
const (
42
42
// rs5 (version 1809, codename "Redstone 5") corresponds to Windows Server
43
43
// 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
45
47
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
48
52
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
51
62
)
52
63
53
64
// List of stable ABI compliant ltsc releases
54
65
// Note: List must be sorted in ascending order
55
66
var compatLTSCReleases = []uint16 {
56
- v21H2Server ,
67
+ LTSC2022 ,
68
+ LTSC2025 ,
57
69
}
58
70
59
71
// CheckHostAndContainerCompat checks if given host and container
@@ -70,18 +82,27 @@ func checkWindowsHostAndContainerCompat(host, ctr windowsOSVersion) bool {
70
82
}
71
83
72
84
// If host is < WS 2022, exact version match is required
73
- if host .Build < v21H2Server {
85
+ if host .Build < LTSC2022 {
74
86
return host .Build == ctr .Build
75
87
}
76
88
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
78
99
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 ]
81
102
break
82
103
}
83
104
}
84
- return ctr . Build >= supportedLtscRelease && ctr .Build <= host .Build
105
+ return supportedLTSCRelease <= ctr . Build && ctr .Build <= host .Build
85
106
}
86
107
87
108
func getWindowsOSVersion (osVersionPrefix string ) windowsOSVersion {
0 commit comments