From 2437c775f2c0f1d8e5041ecf595465adef4f9d55 Mon Sep 17 00:00:00 2001 From: Justin Kolberg Date: Wed, 6 Nov 2024 08:33:30 -0800 Subject: [PATCH] skip arch detection support Signed-off-by: Justin Kolberg --- .github/workflows/build_packages.yml | 2 ++ install-script/install.ps1 | 23 +++++++++++++++++++---- install-script/test/Makefile | 12 +++++++++++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_packages.yml b/.github/workflows/build_packages.yml index f661d4b0..7ae58fb5 100644 --- a/.github/workflows/build_packages.yml +++ b/.github/workflows/build_packages.yml @@ -257,4 +257,6 @@ jobs: working-directory: install-script/test env: S3_BUCKET: sumologic-osc-ci-builds + OVERRIDE_ARCH: x64 + SKIP_ARCHITECTURE_DETECTION: "True" run: make test diff --git a/install-script/install.ps1 b/install-script/install.ps1 index ac221c51..97158f5f 100644 --- a/install-script/install.ps1 +++ b/install-script/install.ps1 @@ -34,8 +34,16 @@ param ( [string] $OpAmpApi, # OverrideArch overrides the architecture detected by this script. This can - # enable installation of x64 packages on an ARM64 system. - [string] $OverrideArch, + # enable installation of x64 packages on an ARM64 system. The default value + # is set to the value of the OVERRIDE_ARCH environment variable. + [string] $OverrideArch = $env:OVERRIDE_ARCH, + + # SkipArchDetection will disable the detection of the CPU architecture. + # CPU architecture detection is slow. Using OverrideArch with this flag + # improves the overall time it takes to execute this script. The default + # value is set to the value of the SKIP_ARCHITECTURE_DETECTION environment + # variable. + [bool] $SkipArchDetection = $env:SKIP_ARCHITECTURE_DETECTION, # S3Bucket is used to specify which S3 bucket to download the MSI package # from. The default value is set to the value of the S3_BUCKET environment @@ -331,8 +339,15 @@ try { $osName = Get-OSName Write-Host "Detected OS type:`t${osName}" - $archName = Get-ArchName -AllowUnsupported ($OverrideArch -ne "") - Write-Host "Detected architecture:`t${archName}" + if ($SkipArchDetection -eq $False) { + $archName = Get-ArchName -AllowUnsupported ($OverrideArch -ne "") + Write-Host "Detected architecture:`t${archName}" + } else { + if ($OverrideArch -eq "") { + Write-Error "OverrideArch flag must be set when using SkipArchDetection" + } + Write-Host "Skipping architecture detection" + } if ($OverrideArch -ne "") { $archName = $OverrideArch diff --git a/install-script/test/Makefile b/install-script/test/Makefile index 9aec136e..8a19d3c0 100644 --- a/install-script/test/Makefile +++ b/install-script/test/Makefile @@ -3,7 +3,17 @@ ifeq ($(OS),Windows_NT) endif ifneq ($(OS),windows) - GOTESTPREFIX ?= sudo env PATH="${PATH}" GH_CI_TOKEN="${GITHUB_TOKEN}" DARWIN_PKG_URL="${DARWIN_PKG_URL}" PACKAGECLOUD_MASTER_TOKEN="${PACKAGECLOUD_MASTER_TOKEN}" PACKAGECLOUD_REPO="${PACKAGECLOUD_REPO}" OTC_VERSION="${OTC_VERSION}" OTC_BUILD_NUMBER="${OTC_BUILD_NUMBER}" S3_BUCKET="${S3_BUCKET}" + GOTESTPREFIX ?= sudo env \ + PATH="${PATH}" \ + GH_CI_TOKEN="${GITHUB_TOKEN}" \ + DARWIN_PKG_URL="${DARWIN_PKG_URL}" \ + PACKAGECLOUD_MASTER_TOKEN="${PACKAGECLOUD_MASTER_TOKEN}" \ + PACKAGECLOUD_REPO="${PACKAGECLOUD_REPO}" \ + OTC_VERSION="${OTC_VERSION}" \ + OTC_BUILD_NUMBER="${OTC_BUILD_NUMBER}" \ + S3_BUCKET="${S3_BUCKET}" \ + OVERRIDE_ARCH="${OVERRIDE_ARCH}" \ + SKIP_ARCHITECTURE_DETECTION="${SKIP_ARCHITECTURE_DETECTION}" endif LINT=golangci-lint