Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix(collector): detect the Windows collector's filename instead of assuming it

shukieshah8e00e94c0d25
diff --git a/.github/workflows/windows-sandbox.yml b/.github/workflows/windows-sandbox.yml
index 4b67ca47..49339570 100644
--- a/.github/workflows/windows-sandbox.yml
+++ b/.github/workflows/windows-sandbox.yml
@@ -91,8 +91,20 @@ jobs:
$env:CGO_ENABLED = '0'
& "$(go env GOPATH)\bin\builder.exe" --config builder.yaml
if ($LASTEXITCODE -ne 0) { throw "collector build failed" }
+ # Detected, not assumed: the builder names its output from dist.name verbatim and does
+ # not append .exe for windows, even though it emits a PE binary. Both spellings are
+ # accepted so a future builder version that does append it keeps working.
+ $produced = 'dist\beacon-otelcol\beacon-otelcol'
+ if (-not (Test-Path -LiteralPath $produced) -and (Test-Path -LiteralPath "$produced.exe")) {
+ $produced = "$produced.exe"
+ }
+ if (-not (Test-Path -LiteralPath $produced)) {
+ Get-ChildItem dist\beacon-otelcol | Out-String | Write-Output
+ throw "the collector build produced no binary under dist\beacon-otelcol"
+ }
New-Item -ItemType Directory -Force -Path dist\beacon-otelcol\windows_amd64 | Out-Null
- Copy-Item dist\beacon-otelcol\beacon-otelcol.exe dist\beacon-otelcol\windows_amd64\beacon-otelcol.exe
+ # Staged with .exe because that is what Windows needs to execute it, whatever it arrived as.
+ Copy-Item $produced dist\beacon-otelcol\windows_amd64\beacon-otelcol.exe
# The layout beacon-sandbox's WindowsLayout() describes. Created here rather than by the
# harness because on this platform the CI job is what provisions the guest.
diff --git a/collector-builder/build-release-collectors.sh b/collector-builder/build-release-collectors.sh
index e7e99110..743059f1 100755
--- a/collector-builder/build-release-collectors.sh
+++ b/collector-builder/build-release-collectors.sh
@@ -15,14 +15,31 @@ while read -r goos goarch; do
echo "Building collector for ${goos}/${goarch}"
rm -rf dist/beacon-otelcol
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 "$builder" --config builder.yaml
- # The builder appends .exe for windows, so the produced name is target-dependent.
- binary="beacon-otelcol"
+
+ # Detected rather than assumed. The builder names its output from dist.name verbatim and does
+ # not append .exe for windows, even though what it produces there is a PE binary -- an earlier
+ # version of this script asserted the .exe name and failed the build immediately after a
+ # successful compile. Both spellings are accepted so a future builder version that does append
+ # it keeps working.
+ produced="dist/beacon-otelcol/beacon-otelcol"
+ if [ ! -f "$produced" ] && [ -f "${produced}.exe" ]; then
+ produced="${produced}.exe"
+ fi
+ if [ ! -f "$produced" ]; then
+ echo "collector build for ${goos}/${goarch} produced no binary at dist/beacon-otelcol/" >&2
+ ls -la dist/beacon-otelcol/ >&2 || true
+ exit 1
+ fi
+
+ # Staged with the extension the *target* needs, which is not the same question as what the
+ # builder emitted: Windows requires .exe to execute the file, so the release artifact carries it
+ # regardless of how it arrived.
+ staged="beacon-otelcol"
if [ "$goos" = "windows" ]; then
- binary="beacon-otelcol.exe"
+ staged="beacon-otelcol.exe"
fi
- test -f "dist/beacon-otelcol/$binary"
mkdir -p "$targets_dir/$target"
- cp "dist/beacon-otelcol/$binary" "$targets_dir/$target/$binary"
+ cp "$produced" "$targets_dir/$target/$staged"
done <<'TARGETS'
darwin amd64
darwin arm64