Fix issues related to architecture-namespaced binaries (#26453)

This PR fixes a couple of issues introduced when we started releasing
separate amd64 and arm64 versions of our windows and linux binaries:

* Adds the architecture string to the download url in the fleetctl npm
package
* Updates the goreleaser templates to only add the architecture to
non-macos (i.e. windows and linux) packages
* Updates the script that the website uses to download fleetctl

I did a weak test of the fleetctl npm installer by hardcoding what was
returned for my system type and at least verified that the download url
worked. Doing some more checks on VMs now.
This commit is contained in:
Scott Gress 2025-02-20 16:42:14 -06:00 committed by GitHub
parent aa16261959
commit 39e9c0a349
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 5 deletions

View file

@ -99,13 +99,15 @@ archives:
- id: fleetctl
builds:
- fleetctl
name_template: fleetctl_v{{.Version}}_{{- if eq .Os "darwin" }}macos{{- else }}{{ .Os }}{{ end }}_{{.Arch}}
# Note -- changing this can break GitOps and other workflows that expect these filenames to be deterministic!
name_template: fleetctl_v{{.Version}}_{{- if eq .Os "darwin" }}macos{{- else }}{{ .Os }}_{{.Arch}}{{ end }}
wrap_in_directory: true
- id: fleetctl-zip
builds:
- fleetctl
name_template: fleetctl_v{{.Version}}_{{- if eq .Os "darwin" }}macos{{- else }}{{ .Os }}{{ end }}_{{.Arch}}
# Note -- changing this can break GitOps and other workflows that expect these filenames to be deterministic!
name_template: fleetctl_v{{.Version}}_{{- if eq .Os "darwin" }}macos{{- else }}{{ .Os }}_{{.Arch}}{{ end }}
format: zip
wrap_in_directory: true

View file

@ -5,6 +5,7 @@ const { spawnSync } = require("child_process");
const { existsSync, mkdirSync } = require("fs");
const { type } = require("os");
const { join } = require("path");
const { arch } = require("process");
const axios = require("axios");
const { rimrafSync } = require("rimraf");
@ -27,9 +28,9 @@ const installDir = join(binDir, strippedVersion);
const platform = (() => {
switch (type()) {
case "Windows_NT":
return "windows";
return `windows_${arch === "arm64" ? "arm64" : "amd64"}`;
case "Linux":
return "linux";
return `linux_${arch === "arm64" ? "arm64" : "amd64"}`;
case "Darwin":
return "macos";
default:

View file

@ -27,8 +27,22 @@ version_gt() {
# Determine operating system (Linux or MacOS)
OS="$(uname -s)"
# Determine architecture (x86_64 or arm64)
ARCH="$(uname -m)"
# Standardize x86_64 to amd64
if [[ $ARCH != "arm64" &&
$ARCH != "aarch64" &&
$ARCH != "aarch64_be" &&
$ARCH != "armv8b" &&
$ARCH != "armv8l"
]];
then
ARCH="amd64";
fi
# Standardize OS name for file download
case "${OS}" in
Linux*) OS='linux' OS_DISPLAY_NAME='Linux';;
Linux*) OS="linux_${ARCH}" OS_DISPLAY_NAME='Linux';;
Darwin*) OS='macos' OS_DISPLAY_NAME='macOS';;
*) echo "Unsupported operating system: ${OS}"; exit 1;;
esac