From bd8ce9805f39aa96ee744995ba89a0420368faa9 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Mon, 6 Nov 2023 12:06:10 -0800 Subject: [PATCH] Add edge rad CLI pull to samples tests (#737) * Add install-radius script Signed-off-by: willdavsmith * chmod Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * test Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith * PR Signed-off-by: willdavsmith --------- Signed-off-by: willdavsmith --- .github/scripts/install-radius.sh | 38 +++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 23 ++++--------------- 2 files changed, 43 insertions(+), 18 deletions(-) create mode 100755 .github/scripts/install-radius.sh diff --git a/.github/scripts/install-radius.sh b/.github/scripts/install-radius.sh new file mode 100755 index 00000000..23af31e2 --- /dev/null +++ b/.github/scripts/install-radius.sh @@ -0,0 +1,38 @@ +# ------------------------------------------------------------ +# Copyright 2023 The Radius Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------ + +set -xe + +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 + +if [[ $VERSION == "edge" ]]; then + echo Downloading rad CLI edge version + oras pull $RAD_CLI_EDGE_URL + chmod +x ./rad + mv ./rad /usr/local/bin/rad +elif [[ -n $VERSION && $VERSION != *"rc"* ]]; then + INPUT_CHANNEL=$(echo $VERSION | cut -d '.' -f 1,2) + echo "Downloading rad CLI version $INPUT_CHANNEL" + wget -q $RAD_CLI_URL -O - | /bin/bash -s $INPUT_CHANNEL +elif [[ -n $VERSION ]]; then + echo Downloading rad CLI version $VERSION + wget -q $RAD_CLI_URL -O - | /bin/bash -s $VERSION +else + echo Downloading latest rad CLI + wget -q $RAD_CLI_URL -O - | /bin/bash +fi diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1905fde2..4b0462fe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,7 +23,6 @@ on: schedule: # 7:45 AM Pacific Time - cron: "45 15 * * *" env: - RAD_CLI_URL: https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh RUN_IDENTIFIER: samplestest-${{ github.run_id }}-${{ github.run_attempt }} jobs: test: @@ -182,23 +181,11 @@ jobs: - name: Download rad CLI if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - for attempt in 1 2 3 4 5; do - if [[ -n "${{ inputs.version }}" && "${{ inputs.version }}" != "edge" && "${{ inputs.version }}" != *"rc"* ]]; then - INPUT_CHANNEL=$(echo "${{ inputs.version }}" | cut -d '.' -f 1,2) - echo "Downloading rad CLI version $INPUT_CHANNEL" - wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s $INPUT_CHANNEL - elif [[ -n "${{ inputs.version }}" ]]; then - echo "Downloading rad CLI version ${{ inputs.version }}" - wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s ${{ inputs.version }} - else - echo "Downloading latest rad CLI" - wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash - fi - - if [ $? -eq 0 ]; then - break - fi - done + RADIUS_VERSION="${{ inputs.version }}" + if [[ -z "${{ inputs.version }}" ]]; then + RADIUS_VERSION=edge + fi + ./.github/scripts/install-radius.sh $RADIUS_VERSION - name: Initialize local environment if: steps.gen-id.outputs.RUN_TEST == 'true' run: |