From 2f2bee85225c2ddc4e81d1d2ecd552e5b195c3dd Mon Sep 17 00:00:00 2001 From: Jahziel Villasana-Espinoza Date: Fri, 1 Mar 2024 09:07:00 -0500 Subject: [PATCH] feat: use an env var to control arch when building orbit for local tuf server (#16263) Just a small developer quality of life update # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Manual QA for all new/changed functionality --- tools/tuf/test/README.md | 8 ++++++++ tools/tuf/test/create_repository.sh | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/tuf/test/README.md b/tools/tuf/test/README.md index 6b893e376b..dacac03e75 100644 --- a/tools/tuf/test/README.md +++ b/tools/tuf/test/README.md @@ -55,6 +55,14 @@ LINUX_TEST_EXTENSIONS="./tools/test_extensions/hello_world/linux/hello_world_lin ./tools/tuf/test/main.sh ``` +To build for a specific architecture, you can pass the `GOARCH` environment variable: +``` shell +[...] +GOARCH=arm64 # defaults to amd64 +[...] +./tools/tuf/test/main.sh +``` + # Add new updates To add new updates (osqueryd or orbit), use `push_target.sh`. diff --git a/tools/tuf/test/create_repository.sh b/tools/tuf/test/create_repository.sh index 42ca58ddc5..2633f096bb 100755 --- a/tools/tuf/test/create_repository.sh +++ b/tools/tuf/test/create_repository.sh @@ -61,13 +61,9 @@ for system in $SYSTEMS; do rm $osqueryd_path goose_value="$system" - goarch_value="" # leave it empty to use the default for the system + goarch_value=${GOARCH:-} if [[ $system == "macos" ]]; then goose_value="darwin" - # for all platforms except Darwin, GOARCH is hardcoded to amd64 to - # prevent cross compilation issues when building macOS arm64 binaries - # from Linux (CGO + libraries are required) - goarch_value="amd64" fi orbit_target=orbit-$system if [[ $system == "windows" ]]; then