Skip to content

Commit

Permalink
Merge pull request #43 from intergral/specified-version-hardcode
Browse files Browse the repository at this point in the history
Hardcodes agent to download specified version
  • Loading branch information
ibalal-intergral authored Feb 12, 2024
2 parents 43d2518 + b32df60 commit 65194e4
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions linux/observability-agent-autoconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -209,19 +208,17 @@ 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;
fi

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"
Expand All @@ -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
Expand Down

0 comments on commit 65194e4

Please sign in to comment.