Skip to content

Commit b4dcd13

Browse files
committed
PRODENG-3471: fix Windows MCR install for FIPS channels
For FIPS channels (e.g. stable-29.2.1/fips) the Windows MCR installer repo publishes versioned artifacts (docker-29.2.1+fips.zip) but does NOT publish docker-latest+fips.zip. Launchpad was hardcoding DOCKER_VERSION=latest, causing install.ps1 to construct a non-existent URL and exit 1 on all Windows nodes. Linux nodes are unaffected. Add windowsInstallerVersion(channel string) as a package-private helper in pkg/configurer/windows.go, alongside the existing isExitCode3010 helper. Returns 'latest' for all non-FIPS channels (preserving current behaviour) and extracts the version from the channel string for FIPS: stable-29.2.1/fips → 29.2.1 test-29.4.1-rc3/fips → 29.4.1-rc3 stable-29.2 → latest (unchanged) InstallMCR uses this instead of the hardcoded 'latest'. Signed-off-by: James Nesbitt <jnesbitt@mirantis.com>
1 parent c691642 commit b4dcd13

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

pkg/configurer/windows.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (c WindowsConfigurer) InstallMCRLicense(h os.Host, lic string) error {
6060

6161
// InstallMCR install MCR on Windows.
6262
func (c WindowsConfigurer) InstallMCR(h os.Host, engineConfig commonconfig.MCRConfig) error {
63-
version := "latest"
63+
version := windowsInstallerVersion(engineConfig.Channel)
6464

6565
installerPath, getInstallerErr := GetInstaller(engineConfig.InstallURLWindows)
6666
if getInstallerErr != nil {
@@ -124,6 +124,25 @@ func isExitCode3010(err error) bool {
124124
return err != nil && strings.Contains(err.Error(), "non-zero exit code: 3010")
125125
}
126126

127+
// windowsInstallerVersion returns the version token to pass as DOCKER_VERSION
128+
// to install.ps1. For non-FIPS channels the repo publishes only
129+
// docker-latest.zip so "latest" is correct. For FIPS channels (suffix /fips)
130+
// the repo publishes docker-<version>+fips.zip but no docker-latest+fips.zip,
131+
// so the version must be extracted from the channel string.
132+
func windowsInstallerVersion(channel string) string {
133+
if !strings.HasSuffix(channel, "/fips") {
134+
return "latest"
135+
}
136+
ch := strings.TrimSuffix(channel, "/fips")
137+
parts := strings.Split(ch, "-")
138+
for i, p := range parts {
139+
if len(p) > 0 && p[0] >= '0' && p[0] <= '9' {
140+
return strings.Join(parts[i:], "-")
141+
}
142+
}
143+
return "latest"
144+
}
145+
127146
// Reboot triggers an immediate forced restart by scheduling a SYSTEM-context
128147
// one-shot task that runs 'shutdown /r /f /t 5', then immediately triggering
129148
// and deleting it within the 5-second countdown window.

pkg/configurer/windows_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package configurer
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
func TestWindowsInstallerVersion(t *testing.T) {
10+
tests := []struct {
11+
channel string
12+
want string
13+
}{
14+
// Standard channels — always "latest"; docker-latest.zip is published
15+
{"stable-29.2", "latest"},
16+
{"stable-25.0", "latest"},
17+
{"ee-stable-29.2", "latest"},
18+
// FIPS channels — version extracted; only docker-<version>+fips.zip is published
19+
{"stable-29.2.1/fips", "29.2.1"},
20+
{"stable-29.4.1/fips", "29.4.1"},
21+
{"test-29.4.1/fips", "29.4.1"},
22+
// FIPS RC channel
23+
{"test-29.4.1-rc3/fips", "29.4.1-rc3"},
24+
// FIPS channel with no parseable version — falls back to latest
25+
{"stable/fips", "latest"},
26+
}
27+
for _, tt := range tests {
28+
t.Run(tt.channel, func(t *testing.T) {
29+
require.Equal(t, tt.want, windowsInstallerVersion(tt.channel), "channel=%q", tt.channel)
30+
})
31+
}
32+
}

0 commit comments

Comments
 (0)