Skip to content

Commit

Permalink
Fix samples test issue with release channel version (#1850)
Browse files Browse the repository at this point in the history
* adding channel to install-rad functionality

Signed-off-by: willdavsmith <[email protected]>

* adding channel to install-rad functionality

Signed-off-by: willdavsmith <[email protected]>

---------

Signed-off-by: willdavsmith <[email protected]>
  • Loading branch information
willdavsmith authored Sep 19, 2024
1 parent dfcfabb commit 5f29100
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/scripts/install-radius.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xe

# VERSION is the version of the rad CLI to download
# e.g. 0.1, 0.1.0, 0.1.0-rc1, edge
VERSION=$1
RAD_CLI_URL=https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh
RAD_CLI_EDGE_URL=ghcr.io/radius-project/rad/linux-amd64:latest
Expand All @@ -26,8 +28,25 @@ if [[ $VERSION == "edge" ]]; then
chmod +x ./rad
mv ./rad /usr/local/bin/rad
elif [[ -n $VERSION ]]; then
echo Downloading rad CLI version $VERSION
wget -q $RAD_CLI_URL -O - | /bin/bash -s $VERSION
RADIUS_VERSION=$VERSION
# if version is a channel, e.g. 0.1
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
echo "Querying the most recent version of the specified channel: $VERSION"
RADIUS_VERSION=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/radius-project/radius/releases | jq -r '.[] | .tag_name | select(startswith("v'$VERSION'"))' | head -n 1)
echo "Found version $RADIUS_VERSION"
if [[ -z "$RADIUS_VERSION" ]]; then
echo "No releases found for channel $VERSION"
exit 1
fi
else
echo "The string does not match the pattern [anynumber].[anynumber]"
fi

# remove the 'v' prefix
RADIUS_VERSION=$(echo $RADIUS_VERSION | cut -d "v" -f 2)

echo Downloading rad CLI version $RADIUS_VERSION
wget -q $RAD_CLI_URL -O - | /bin/bash -s $RADIUS_VERSION
else
echo Downloading latest rad CLI
wget -q $RAD_CLI_URL -O - | /bin/bash
Expand Down

0 comments on commit 5f29100

Please sign in to comment.