From b32df60e598d8e18aa469fa0d4618e5ee6c41330 Mon Sep 17 00:00:00 2001 From: Ibrahim Balal Date: Mon, 12 Feb 2024 20:16:49 +0000 Subject: [PATCH] Hardcoded agent to download specified version --- linux/observability-agent-autoconf.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/linux/observability-agent-autoconf.sh b/linux/observability-agent-autoconf.sh index e1a39bb..21496b0 100755 --- a/linux/observability-agent-autoconf.sh +++ b/linux/observability-agent-autoconf.sh @@ -192,8 +192,7 @@ if [ "$INSTALL" != false ]; then if [ "$ARCH" != "unsupported" ]; then echo "Downloading binary..." # download the binary - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/grafana/agent/releases/latest | jq ".assets[] | select((.name | test(\"flow\")) and (.name|match(\"darwin-$ARCH.zip$\"))) | .browser_download_url" | tr -d '"') - curl -LO "$DOWNLOAD_URL" + curl -O -L "https://github.com/grafana/agent/releases/download/v0.39.2/grafana-agent-darwin-$ARCH.zip" # extract the binary unzip "grafana-agent-darwin-$ARCH.zip" # make sure it is executable @@ -209,9 +208,8 @@ if [ "$INSTALL" != false ]; then else if [ "$OS" = "Debian" ]; then if [ "$ARCH" != "unsupported" ]; then - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/grafana/agent/releases/latest | jq '.assets[] | select((.name | test("flow")) and (.name | endswith("'"$ARCH.deb"'"))) | .browser_download_url' | tr -d '"') - curl -LO "$DOWNLOAD_URL" - dpkg -i "$(basename "$DOWNLOAD_URL")" + curl -O -L "https://github.com/grafana/agent/releases/download/v0.39.2/grafana-agent-flow-0.39.2-1.$ARCH.deb" + dpkg -i "grafana-agent-flow-0.39.2-1.$ARCH.deb" else echo "Architecture not supported" exit 1; @@ -219,9 +217,8 @@ if [ "$INSTALL" != false ]; then elif [ "$OS" = "RedHat" ] || [ "$OS" = "SUSE" ]; then if [ "$ARCH" != "unsupported" ]; then - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/grafana/agent/releases/latest | jq '.assets[] | select((.name | test("flow")) and (.name | endswith("'"$ARCH.rpm"'"))) | .browser_download_url' | tr -d '"') - curl -LO "$DOWNLOAD_URL" - rpm -i "$(basename "$DOWNLOAD_URL")" + curl -O -L "https://github.com/grafana/agent/releases/download/v0.39.2/grafana-agent-flow-0.39.2-1.$ARCH.rpm" + rpm -i "grafana-agent-flow-0.39.2-1.$ARCH.rpm" #change after config updated else echo "Architecture not supported" @@ -231,12 +228,12 @@ if [ "$INSTALL" != false ]; then echo "OS not supported, downloading binary..." # Download the binary # Can't install jq if OS is unknown, therefore can't get latest binary - curl -O -L "https://github.com/grafana/agent/releases/download/v0.34.0/grafana-agent-flow-0.34.2-1.$ARCH.zip" + curl -O -L "https://github.com/grafana/agent/releases/download/v0.39.2/grafana-agent-flow-0.39.2-1.$ARCH.zip" # extract the binary - unzip "grafana-agent-flow-0.34.2-1.$ARCH.zip" + unzip "grafana-agent-flow-0.39.2-1.$ARCH.zip" # make sure it is executable - chmod a+x "grafana-agent-flow-0.34.2-1.$ARCH.zip" - binLocation="$(pwd)/grafana-agent-flow-0.34.2-1.$ARCH.zip" + chmod a+x "grafana-agent-flow-0.39.2-1.$ARCH.zip" + binLocation="$(pwd)/grafana-agent-flow-0.39.2-1.$ARCH.zip" # echo the location of the binary echo "Binary location: $binLocation" asBinary=true