From 46b41e9abb0626df637b4d22488be6750b2c745a Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Sep 2024 13:52:54 -0700 Subject: [PATCH 1/3] fixing release version issues Signed-off-by: willdavsmith --- .github/scripts/release-samples.sh | 16 ++++++++ .github/workflows/test.yaml | 59 ++++++++++++++++++++---------- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/.github/scripts/release-samples.sh b/.github/scripts/release-samples.sh index 9c6d7764..2f1bfe25 100755 --- a/.github/scripts/release-samples.sh +++ b/.github/scripts/release-samples.sh @@ -37,6 +37,22 @@ echo "Channel version: ${CHANNEL_VERSION}" echo "Creating release branch for ${REPOSITORY}..." pushd $REPOSITORY + git checkout -B "${CHANNEL_VERSION}" + +# Update bicepconfig.json br:biceptypes.azurecr.io/radius with the CHANNEL +BICEPCONFIG_RADIUS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/radius:${CHANNEL}" +awk -v REPLACEMENT="${BICEPCONFIG_RADIUS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/radius:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json +mv bicepconfig_updated.json bicepconfig.json + +# Update bicepconfig.json br:biceptypes.azurecr.io/aws with the CHANNEL +BICEPCONFIG_AWS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/aws:${CHANNEL}" +awk -v REPLACEMENT="${BICEPCONFIG_AWS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/aws:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json +mv bicepconfig_updated.json bicepconfig.json + +# Push changes to GitHub +git add --all +git commit -m "Update docs for ${VERSION}" git push origin "${CHANNEL_VERSION}" + popd diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 750fd9ad..348c42e6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,17 +4,9 @@ on: workflow_dispatch: inputs: version: - description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge." + description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge)." required: false - default: "edge" type: string - push: - branches: - - v*.* - - edge - paths: - - "samples/**" - - ".github/workflows/**" pull_request: types: [opened, synchronize, reopened] branches: @@ -93,7 +85,6 @@ jobs: credential: aws enableDapr: false env: - BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} AZURE_LOCATION: westus3 AWS_REGION: us-west-2 @@ -123,6 +114,40 @@ jobs: echo "TEST_EKS_CLUSTER_NAME=eks-${RUN_IDENTIFIER}" >> $GITHUB_OUTPUT echo "RUN_TEST=${RUN_TEST}" >> $GITHUB_OUTPUT echo "ENABLE_DAPR=${ENABLE_DAPR}" >> $GITHUB_OUTPUT + - name: Generate Radius version variables + id: gen-radius-version + if: steps.gen-id.outputs.RUN_TEST == 'true' + run: | + RADIUS_VERSION=edge + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + RADIUS_VERSION=${{ github.event.inputs.version }} + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + # Get the target branch of the pull request + TARGET_BRANCH=${{ github.event.pull_request.base.ref }} + if [[ "$TARGET_BRANCH" == "edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/pull/v[0-9]+\.[0-9]+/merge$ ]]; then + # Example: refs/pull/v0.1/merge -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + fi + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + # Get the branch of the schedule event + TARGET_BRANCH=${{ github.ref }} + if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then + # Example: refs/heads/v0.1 -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + else + echo "Invalid branch name: $TARGET_BRANCH" + exit 1 + fi + else + echo "Invalid event name: ${{ github.event_name }}" + exit 1 + fi + + echo "RADIUS_VERSION=$RADIUS_VERSION" >> $GITHUB_OUTPUT - name: Checkout code if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/checkout@v4 @@ -213,11 +238,7 @@ jobs: - name: Download rad CLI if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - RADIUS_VERSION="${{ inputs.version }}" - if [[ -z "${{ inputs.version }}" ]]; then - RADIUS_VERSION=edge - fi - ./.github/scripts/install-radius.sh $RADIUS_VERSION + ./.github/scripts/install-radius.sh ${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} - name: Initialize default environment if: steps.gen-id.outputs.RUN_TEST == 'true' run: | @@ -231,10 +252,10 @@ jobs: rad group switch default rad env create default rad env switch default - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest --resource-type Applications.Datastores/sqlDatabases - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest --resource-type Applications.Messaging/rabbitMQQueues + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/redisCaches + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/mongoDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/sqlDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Messaging/rabbitMQQueues - name: Configure cloud credentials if: steps.gen-id.outputs.RUN_TEST == 'true' && ( matrix.credential == 'azure' || matrix.credential == 'aws') run: | From ef2237e6edd0ae015aa71c64d0e5d8dc4b8c9d2f Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Sep 2024 13:57:58 -0700 Subject: [PATCH 2/3] fixing release version issues Signed-off-by: willdavsmith --- .github/scripts/release-samples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/release-samples.sh b/.github/scripts/release-samples.sh index 2f1bfe25..115dc9a0 100755 --- a/.github/scripts/release-samples.sh +++ b/.github/scripts/release-samples.sh @@ -52,7 +52,7 @@ mv bicepconfig_updated.json bicepconfig.json # Push changes to GitHub git add --all -git commit -m "Update docs for ${VERSION}" +git commit -m "Update samples for ${VERSION}" git push origin "${CHANNEL_VERSION}" popd From 78eb23c85b7e75d50d4a20a24c22f52977892a37 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Sep 2024 14:06:21 -0700 Subject: [PATCH 3/3] fixing release version issues Signed-off-by: willdavsmith --- .github/workflows/test.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 348c42e6..dd24922b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,6 +7,13 @@ on: description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge)." required: false type: string + push: + branches: + - v*.* + - edge + paths: + - "samples/**" + - ".github/workflows/**" pull_request: types: [opened, synchronize, reopened] branches: @@ -121,6 +128,15 @@ jobs: RADIUS_VERSION=edge if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then RADIUS_VERSION=${{ github.event.inputs.version }} + elif [[ "${{ github.event_name }}" == "push" ]]; then + # Get the target branch of the push event + TARGET_BRANCH=${{ github.ref }} + if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then + # Example: refs/heads/v0.1 -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + fi elif [[ "${{ github.event_name }}" == "pull_request" ]]; then # Get the target branch of the pull request TARGET_BRANCH=${{ github.event.pull_request.base.ref }}