Skip to content

Commit

Permalink
Use case statement to determine ARCH in packer/linux/conf/bin/bk-inst…
Browse files Browse the repository at this point in the history
…all-elastic-stack.sh
  • Loading branch information
triarius committed Jun 9, 2023
1 parent d0bb6f2 commit 3c7c3a5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packer/linux/conf/bin/bk-install-elastic-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ on_error() {

trap 'on_error $LINENO' ERR

case $(uname -m) in
x86_64) ARCH=amd64;;
aarch64) ARCH=arm64;;
*) ARCH=unknown;;
esac

# even though the token is only vaild for 60s, let's not leak it into the logs
set +x
token=$(curl -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 60" --fail --silent --show-error --location "http://169.254.169.254/latest/api/token")
Expand Down Expand Up @@ -91,14 +97,9 @@ set_unless_present "AWS_REGION" "$AWS_REGION"
EOF

if [[ "${BUILDKITE_AGENT_RELEASE}" == "edge" ]]; then
if [[ "$(uname -m)" == "aarch64" ]]; then
AGENT_ARCH="arm64"
else
AGENT_ARCH="amd64"
fi
echo "Downloading buildkite-agent edge..."
curl -Lsf -o /usr/bin/buildkite-agent-edge \
"https://download.buildkite.com/agent/experimental/latest/buildkite-agent-linux-${AGENT_ARCH}"
"https://download.buildkite.com/agent/experimental/latest/buildkite-agent-linux-${ARCH}"
chmod +x /usr/bin/buildkite-agent-edge
buildkite-agent-edge --version
fi
Expand Down

0 comments on commit 3c7c3a5

Please sign in to comment.