diff --git a/build/scripts/build-client-binary b/build/scripts/build-client-binary index 7a5a6b4b1a..fb3bd3532c 100755 --- a/build/scripts/build-client-binary +++ b/build/scripts/build-client-binary @@ -19,6 +19,21 @@ gobuild_component() { local component_path=$4 local result_file=${5:-bin/$(basename ${component_path:-$extract_path})} + # Set target for Nomad accordingly + local target + case "$(uname -m)" in + x86_64) + target="linux_amd64" + ;; + aarch64) + target="linux_arm64" + ;; + *) + echo "Unsupported architecture: $(uname -m)" + exit 1 + ;; + esac + if [ ${component} = 'azure_metrics_exporter' ]; then result_file=${result_file/_metrics/} fi @@ -38,7 +53,7 @@ gobuild_component() { elif [ ${component} = 'percona-toolkit' ]; then build_command="cd /tmp/go/src/${extract_path}/${component_path} && go build -o \${binary_dir}/${result_file} ." elif [ ${component} = 'nomad' ]; then - build_command="cd /tmp/go/src/${extract_path} && TARGETS=linux_amd64 make deps release" + build_command="cd /tmp/go/src/${extract_path} && TARGETS=${target} make deps release" else build_command="go build -o \${binary_dir}/${result_file} ./src/${extract_path}/${component_path}" fi @@ -130,7 +145,7 @@ main() { gobuild_component "percona-toolkit" "" "github.com/percona/percona-toolkit" "src/go/pt-mongodb-summary" gobuild_component "percona-toolkit" "" "github.com/percona/percona-toolkit" "src/go/pt-pg-summary" - cp -r ${tmp_dir}/go/src/github.com/hashicorp/nomad/pkg/linux_amd64/nomad ${binary_dir}/bin/nomad + cp -r ${tmp_dir}/go/src/github.com/hashicorp/nomad/pkg/linux_*/nomad ${binary_dir}/bin/nomad rm -rf ${binary_tarball} mkdir -p $(dirname ${binary_tarball}) || :