Skip to content

Commit

Permalink
skip arch detection support
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Kolberg <[email protected]>
  • Loading branch information
amdprophet committed Nov 6, 2024
1 parent 787856d commit 2437c77
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 19 additions & 4 deletions install-script/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion install-script/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2437c77

Please sign in to comment.