diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3e89d12e..a2f00fd2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -124,9 +124,9 @@ jobs: 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) + elif [[ "$TARGET_BRANCH" =~ ^v[0-9]+\.[0-9]+$ ]]; then + # Example: v0.1 -> 0.1 + RADIUS_VERSION=${TARGET_BRANCH#v} fi elif [[ "${{ github.event_name }}" == "schedule" ]]; then # Get the branch of the schedule event @@ -209,11 +209,7 @@ jobs: - name: Initialize default environment if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - if [[ "${{ matrix.previewFlag }}" == "true" ]]; then - rad install kubernetes --set rp.publicEndpointOverride=localhost --preview - else - rad install kubernetes --set rp.publicEndpointOverride=localhost - fi + rad install kubernetes --set rp.publicEndpointOverride=localhost echo "*** Verify manifests are registered ***" rm -f registermanifest_logs.txt @@ -259,16 +255,20 @@ jobs: exit 1 fi + # Installation creates only the control plane; initialize deployment state explicitly. + previewArg="" if [[ "${{ matrix.previewFlag }}" == "true" ]]; then - # 'rad install kubernetes --preview' already created the default resource group and - # the Radius.Core/environments/default environment with the default recipe pack; - # bind that environment to the workspace with -e so rad deploy can resolve it. - rad workspace create kubernetes default --group default --preview -e default - else - # 'rad install kubernetes' already created the default resource group and the - # Applications.Core/environments/default environment; bind both to the workspace with - # -e so no group/env switch is needed, then register the datastore recipes. - rad workspace create kubernetes default --group default -e default + previewArg="--preview" + fi + + rad group create default + rad workspace create kubernetes default --group default + + # Preview environment creation also provisions the default recipe pack. + rad env create default $previewArg + rad env switch default $previewArg + + if [[ "${{ matrix.previewFlag }}" != "true" ]]; then 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