Fix Windows CLI download: missing CDN fallback + missing .exe extension - #98
Conversation
PR Summary by QodoSupport Windows ZIP binaries with CDN download fallback
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. CGW tests fail on Windows
|
|
@kdacosta0 maybe it will require rebase or other fix to enable e2e CI |
The CDN fallback logic in the openshift strategy only triggered for .tar.gz links, so Windows binaries (distributed as .zip) fell through to a code path with no retry/fallback and no zip extraction support, causing hard failures when the primary content-gateway download returned a 400. Add zip extraction support and wire the same stable-version CDN fallback used for .tar.gz into the .zip path, and fix the same hardcoded .tar.gz assumption in the cgw strategy. Co-authored-by: Cursor <cursoragent@cursor.com>
FindBinary always symlinked the extracted binary to a bare cliName (no extension) on Windows, because it compared the .exe-suffixed candidate names against the never-suffixed cliName, which are never equal. This made the symlink branch (and its extension-less link) unconditional on Windows for every content-gateway archive tool (rekor-cli, gitsign, ec, createtree, updatetree, ...), causing "executable file not found in %PATH%" once the binary was actually invoked via a full path. Compare against a Windows-aware linkName instead so the returned/symlinked path keeps its .exe suffix. Co-authored-by: Cursor <cursoragent@cursor.com>
10e1b1d to
6188b94
Compare
What changed & why
Two bugs were stacked on top of each other, both Windows-only, both in how CLI binaries (
rekor-cli,gitsign,ec, etc.) get downloaded/resolved for tests:.zipdownloads. The fallback-to-last-stable-version logic only ran for.tar.gzlinks. Windows binaries are.zip, so they skipped it entirely and just hard-failed when the primary download 400'd.FindBinarystripped the.exeextension. Once (1) was fixed and the zip download succeeded, the code that locates the binary inside the extracted archive always created a shortcut (symlink) named without.exeon Windows, so the binary couldn't actually be executed.Before / after
Bug 1 — download:
.ziplink fails 5 times (400) → no fallback → test fails immediately..ziplink fails 5 times → falls back to last stable version via CDN, same as.tar.gzalready did on macOS/Linux → download succeeds.Bug 2 — execution (only visible once bug 1 was fixed):
rekor_cli_windows_amd64.exe, butFindBinarylinks it to a barerekor-cli(no extension) and returns that path. RunningC:\...\rekor-clidirectly fails withexecutable file not found in %PATH%, because Windows won't guess the extension when given a full path.FindBinarylinks it torekor-cli.exeinstead, so the returned path is a valid, correctly-named executable and runs normally.Test plan
go build ./...go vet ./...go test ./pkg/support/... ./pkg/strategy/...— includesTestStrategyContentGatewayZip(exercises the previously-broken.zipdownload+fallback path end-to-end) andTestFindBinaryWindowsPreservesExeExtension(regression test for the.exe-stripping bug)Made with Cursor