Skip to content

Commit

Permalink
PMM-13540 Fix pmm client v3 build for nomad. (#3298)
Browse files Browse the repository at this point in the history
* PMM-13540 Fix pmm client v3 build for nomad.
  • Loading branch information
talhabinrizwan authored Nov 12, 2024
1 parent 6bfa326 commit 9369be0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions build/scripts/build-client-binary
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}) || :
Expand Down

0 comments on commit 9369be0

Please sign in to comment.