diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..b0de1df1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# text files use OS defaults on checkout, LF on checkin +* text eol=auto +# images are binary +*.png binary \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 67d114b6..d0917036 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners # Default rule: anything that doesn't match a more specific rule goes here -* @project-radius/radius-pm +* @radius-project/radius-pm diff --git a/.github/scripts/release-samples.sh b/.github/scripts/release-samples.sh new file mode 100755 index 00000000..9c6d7764 --- /dev/null +++ b/.github/scripts/release-samples.sh @@ -0,0 +1,42 @@ +# ------------------------------------------------------------ +# 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_NUMBER=$1 # (e.g. 0.1.0) +REPOSITORY="samples" + +if [[ -z "$VERSION_NUMBER" ]]; then + echo "Error: VERSION_NUMBER is not set." + exit 1 +fi + +# CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) +CHANNEL="$(echo $VERSION_NUMBER | cut -d '.' -f 1,2)" + +# CHANNEL_VERSION is the version with the 'v' prefix (e.g. v0.1) +CHANNEL_VERSION="v${CHANNEL}" + +echo "Version number: ${VERSION_NUMBER}" +echo "Channel: ${CHANNEL}" +echo "Channel version: ${CHANNEL_VERSION}" + +echo "Creating release branch for ${REPOSITORY}..." + +pushd $REPOSITORY +git checkout -B "${CHANNEL_VERSION}" +git push origin "${CHANNEL_VERSION}" +popd diff --git a/.github/scripts/validate_semver.py b/.github/scripts/validate_semver.py index 7f182606..6d06b9d3 100755 --- a/.github/scripts/validate_semver.py +++ b/.github/scripts/validate_semver.py @@ -29,12 +29,13 @@ def main(): SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" pattern = re.compile(SEMVER_REGEX) - version = sys.argv[1] match = pattern.search(version) - - # If no match, then return an error (provided version is not valid semver) - if match is None: + + if version == "edge": + print("Provided version is edge") + sys.exit(0) + elif match is None: print("Provided version is not valid semver") sys.exit(1) else: diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 40c436e0..ca161af9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,41 +19,19 @@ concurrency: env: VERSION: ${{ github.event.pull_request.number || 'edge' }} # Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. + # TODO_LAUNCH: Remove this env var once we opensource the repo - https://github.com/radius-project/samples/issues/439 DOCKER_REGISTRY: ${{ github.event.pull_request.number && 'radiusdev.azurecr.io' || 'radius.azurecr.io' }} + # Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. + CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project/samples' }} + # Set to true to push images to registry. + PUSH_IMAGE: true jobs: + # TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/radius-project/samples/issues/439 build: - name: Build and push ${{ matrix.name }} + name: Build and push sample images to ACR if: github.event.action != 'closed' runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - name: demo - path: ./demo/ - tag: tutorial/demo - - name: webapp - path: ./demo/ - tag: tutorial/webapp - - name: dapr-backend - path: ./quickstarts/dapr/nodeapp/ - tag: quickstarts/dapr-backend - - name: dapr-frontend - path: ./quickstarts/dapr/ui/ - tag: quickstarts/dapr-frontend - - name: aws-reference-app - path: ./reference-apps/aws/ - tag: reference-apps/aws - - name: environment-variables - path: ./quickstarts/environment-variables/ - tag: quickstarts/envvars - - name: volumes - path: ./quickstarts/volumes/ - tag: quickstarts/volumes - - name: aws-sqs - path: ./reference-apps/aws-sqs/ - tag: reference-apps/aws-sqs-sample steps: - name: Checkout code uses: actions/checkout@v3.5.2 @@ -63,10 +41,120 @@ jobs: login-server: ${{ env.DOCKER_REGISTRY }} username: '${{ secrets.AZURE_SP_DOCKER_USERNAME }}' password: '${{ secrets.AZURE_SP_DOCKER_PASSWORD }}' - - name: Build ${{ matrix.name }} - run: docker build ${{ matrix.path }} -t "${{ env.DOCKER_REGISTRY }}/${{ matrix.tag }}:${{ env.VERSION }}" - - name: Push ${{ matrix.name }} - run: docker push "${{ env.DOCKER_REGISTRY }}/${{ matrix.tag }}:${{ env.VERSION }}" + - name: demo + uses: docker/build-push-action@v4 + with: + context: ./demo/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/tutorial/demo:${{ env.VERSION }} + - name: webapp + uses: docker/build-push-action@v4 + with: + context: ./demo/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/tutorial/webapp:${{ env.VERSION }} + - name: dapr-backend + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/dapr/nodeapp/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/dapr-backend:${{ env.VERSION }} + - name: dapr-frontend + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/dapr/ui/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/dapr-frontend:${{ env.VERSION }} + - name: aws-reference-app + uses: docker/build-push-action@v4 + with: + context: ./reference-apps/aws/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/reference-apps/aws:${{ env.VERSION }} + - name: environment-variables + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/environment-variables/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/envvars:${{ env.VERSION }} + - name: volumes + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/volumes/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/volumes:${{ env.VERSION }} + - name: aws-sqs + uses: docker/build-push-action@v4 + with: + context: ./reference-apps/aws-sqs/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.DOCKER_REGISTRY }}/reference-apps/aws-sqs-sample:${{ env.VERSION }} + build-container: + name: Build and push sample images to GHCR + if: github.event.action != 'closed' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout code + uses: actions/checkout@v3.5.2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: demo + uses: docker/build-push-action@v4 + with: + context: ./demo/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/tutorial/demo:${{ env.VERSION }} + - name: webapp + uses: docker/build-push-action@v4 + with: + context: ./demo/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/tutorial/webapp:${{ env.VERSION }} + - name: dapr-backend + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/dapr/nodeapp/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/dapr-backend:${{ env.VERSION }} + - name: dapr-frontend + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/dapr/ui/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/dapr-frontend:${{ env.VERSION }} + - name: aws-reference-app + uses: docker/build-push-action@v4 + with: + context: ./reference-apps/aws/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/reference-apps/aws:${{ env.VERSION }} + - name: environment-variables + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/environment-variables/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/envvars:${{ env.VERSION }} + - name: volumes + uses: docker/build-push-action@v4 + with: + context: ./quickstarts/volumes/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/volumes:${{ env.VERSION }} + - name: aws-sqs + uses: docker/build-push-action@v4 + with: + context: ./reference-apps/aws-sqs/ + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.CONTAINER_REGISTRY }}/reference-apps/aws-sqs-sample:${{ env.VERSION }} + + # TODO_LAUNCH: Remove this job once we opensource the repo because all pkgs will be cleaned up regularly - https://github.com/radius-project/samples/issues/439 cleanup: name: Cleanup ${{ matrix.image }} if: github.event.action == 'closed' diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml index f9571771..5899f101 100644 --- a/.github/workflows/issues.yaml +++ b/.github/workflows/issues.yaml @@ -18,8 +18,8 @@ jobs: ISSUE: ${{ github.event.issue.html_url }} AUTHOR: ${{ github.actor }} run: | - MEMBERS=$(gh api orgs/project-radius/teams/Radius-Preview/members | jq -r '.[] | .login') - ADMINS=$(gh api orgs/project-radius/teams/Radius-Admin/members | jq -r '.[] | .login') + MEMBERS=$(gh api orgs/radius-project/teams/Radius-Preview/members | jq -r '.[] | .login') + ADMINS=$(gh api orgs/radius-project/teams/Radius-Admin/members | jq -r '.[] | .login') for USER in $MEMBERS; do if [[ "$USER" == "$AUTHOR" ]]; then ISADMIN=false diff --git a/.github/workflows/purge-aws-test-resources.yaml b/.github/workflows/purge-aws-test-resources.yaml deleted file mode 100644 index 919c8f07..00000000 --- a/.github/workflows/purge-aws-test-resources.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: Purge AWS Test Resources -on: - schedule: - - cron: "30 0,12 * * *" -env: - VALID_RESOURCE_WINDOW: 6*60*60 - AWS_REGION: us-east-2 - RESOURCE_TYPES: 'AWS::Kinesis::Stream,AWS::S3::Bucket,AWS::RDS::DBInstance,AWS::RDS::DBSubnetGroup,AWS::MemoryDB::Cluster,AWS::MemoryDB::SubnetGroup' -jobs: - purge_aws_resources: - name: AWS Test Resources Clean-up - runs-on: [self-hosted, 1ES.Pool=1ES-Radius] - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - name: List EKS Clusters - id: list-clusters - run: | - CLUSTERS=$(eksctl get clusters --region ${{ env.AWS_REGION }} --output json | jq -r '.[].metadata.name') - echo "::set-output name=clusters::$CLUSTERS" - - name: Filter Old Clusters - id: filter-clusters - run: | - OLD_CLUSTERS="" - for CLUSTER in ${{ steps.list-clusters.outputs.clusters }}; do - CREATED_AT=$(aws eks describe-cluster --name $CLUSTER --region ${{ env.AWS_REGION }} --query 'cluster.createdAt' --output text) - CREATED_TIMESTAMP=$(date -d $CREATED_AT +%s) - CURRENT_TIMESTAMP=$(date +%s) - ELAPSED_TIME=$((CURRENT_TIMESTAMP - CREATED_TIMESTAMP)) - if [[ $ELAPSED_TIME -gt ${{ env.VALID_RESOURCE_WINDOW }} ]]; then - OLD_CLUSTERS="$OLD_CLUSTERS $CLUSTER" - fi - done - echo "::set-output name=old-clusters::$OLD_CLUSTERS" - - name: Delete Old Clusters - if: steps.filter-clusters.outputs.old-clusters != '' - run: | - for CLUSTER in ${{ steps.filter-clusters.outputs.old-clusters }}; do - eksctl delete cluster --name $CLUSTER --region ${{ env.AWS_REGION }} --wait - done - - name: Filter and delete old resources - run: | - - - name: Create GitHub issue on failure - if: ${{ failure() }} - run: | - gh issue create --title "Samples purge AWS test resources failed" \ - --body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \ - --repo ${{ github.repository }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..ff2489ac --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,49 @@ +name: Release samples + +on: + workflow_dispatch: + inputs: + version: + description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' + required: true + default: '' + type: string + +env: + GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }} + GITHUB_EMAIL: 'radiuscoreteam@service.microsoft.com' + GITHUB_USER: 'Radius CI Bot' + +jobs: + release-samples: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_RAD_CI_BOT_PAT }} + ref: edge + path: samples + - name: Configure git + run: | + git config --global user.email "${{ env.GITHUB_EMAIL }}" + git config --global user.name "${{ env.GITHUB_USER }}" + - name: Ensure inputs.version is valid semver + run: | + python ./samples/.github/scripts/validate_semver.py ${{ inputs.version }} + - name: Parse release channel + id: parse_release_channel + run: | + # CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) + CHANNEL="$(echo ${{ inputs.version }} | cut -d '.' -f 1,2)" + echo "channel=$CHANNEL" >> $GITHUB_OUTPUT + - name: Release samples + run: | + ./samples/.github/scripts/release-samples.sh ${{ inputs.version }} + - name: Change the default branch + run: | + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/radius-project/samples \ + -f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d7f897b1..6a1cf0a6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,12 +1,12 @@ -name: Test Quickstarts +name: Test Samples on: workflow_dispatch: inputs: version: - description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' + description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1, edge). Defaults to edge.' required: false - default: '' + default: 'edge' type: string push: branches: @@ -15,6 +15,7 @@ on: paths: - "quickstarts/**" - "reference-apps/**" + - "demo/**" - ".github/workflows/**" pull_request: types: [opened, synchronize, reopened] @@ -23,83 +24,131 @@ on: - edge schedule: # 7:45 AM Pacific Time - cron: "45 15 * * *" - +env: + RAD_CLI_URL: https://get.radapp.dev/tools/rad/install.sh jobs: test: - name: Deploy quickstarts to local environment - if: github.event.action != 'closed' + name: Sample tests runs-on: [self-hosted, 1ES.Pool=1ES-Radius-Samples] strategy: fail-fast: false matrix: include: - name: demo + runOnPullRequest: true app: demo path: ./demo/app.bicep args: --application demo uiTestFile: tests/demo.app.spec.ts port: 3000 container: demo + enableDapr: false - name: dapr + runOnPullRequest: true app: dapr-quickstart path: ./quickstarts/dapr/dapr.bicep enableDapr: true - name: environment-variables + runOnPullRequest: true app: myapp path: ./quickstarts/environment-variables/app.bicep + enableDapr: false - name: volumes + runOnPullRequest: true app: myapp path: ./quickstarts/volumes/app.bicep + enableDapr: false - name: eshop + runOnPullRequest: true app: eshop path: ./reference-apps/eshop/iac/eshop.bicep args: --application eshop uiTestFile: tests/eshop/container.app.spec.ts + enableDapr: false - name: eshop-azure + runOnPullRequest: false app: eshop path: ./reference-apps/eshop/iac/eshop.bicep args: --application eshop -p platform=azure uiTestFile: tests/eshop/container.app.spec.ts credential: azure + enableDapr: false - name: eshop-aws app: eshop path: ./reference-apps/eshop/iac/eshop.bicep args: --application eshop -p platform=aws uiTestFile: tests/eshop/container.app.spec.ts credential: aws + enableDapr: false env: BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} AZURE_LOCATION: westus3 - AWS_REGION: us-east-2 + AWS_REGION: us-west-2 steps: + # Setup the test assets and configuration - name: Generate output variables id: gen-id run: | BASE_STR="SAMPLES|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) + + if [[ "${{ github.event_name }}" == "pull_request" && "${{ matrix.runOnPullRequest }}" == "false" ]]; then + RUN_TEST=false + else + RUN_TEST=true + fi + + if [[ "${{ matrix.enableDapr }}" == "true" ]]; then + ENABLE_DAPR=true + else + ENABLE_DAPR=false + fi # Set output variables to be used in the other jobs echo "UNIQUE_ID=${UNIQUE_ID}" >> $GITHUB_OUTPUT echo "TEST_RESOURCE_GROUP_PREFIX=samplestest-${UNIQUE_ID}" >> $GITHUB_OUTPUT echo "TEST_EKS_CLUSTER_NAME=samplestest-eks-${UNIQUE_ID}" >> $GITHUB_OUTPUT echo "TEST_UNIQUE_APP_NAME=${{ matrix.name }}-${UNIQUE_ID}" >> $GITHUB_OUTPUT - - name: Checkout Code + echo "RUN_TEST=${RUN_TEST}" >> $GITHUB_OUTPUT + echo "ENABLE_DAPR=${ENABLE_DAPR}" >> $GITHUB_OUTPUT + - name: Checkout code + if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/checkout@v3 - name: Ensure inputs.version is valid semver - if: inputs.version != '' + if: inputs.version != '' && steps.gen-id.outputs.RUN_TEST == 'true' run: | - ./scripts/validate-version.sh ${{ inputs.version }} + python ./.github/scripts/validate_semver.py ${{ inputs.version }} - name: Setup Node + if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/setup-node@v3 with: node-version: 16 - - name: az CLI Login + - name: az CLI login + if: matrix.credential == 'azure' && steps.gen-id.outputs.RUN_TEST == 'true' run: | az login --service-principal \ --username ${{ secrets.AZURE_SP_TESTS_APPID }} \ --password ${{ secrets.AZURE_SP_TESTS_PASSWORD }} \ --tenant ${{ secrets.AZURE_SP_TESTS_TENANTID }} + # Create and install test environment + - name: Create Azure resource group + id: create-azure-resource-group + if: matrix.credential == 'azure' && steps.gen-id.outputs.RUN_TEST == 'true' + env: + RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} + SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} + run: | + current_time=$(date +%s) + az group create \ + --location ${{ env.AZURE_LOCATION }} \ + --name $RESOURCE_GROUP \ + --subscription $SUBSCRIPTION_ID \ + --tags creationTime=$current_time + while [ $(az group exists --name $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID) = false ]; do + echo "Waiting for resource group $RESOURCE_GROUP to be created..." + sleep 5 + done - name: Configure AWS if: matrix.credential == 'aws' run: | @@ -111,19 +160,14 @@ jobs: id: create-eks env: EKS_CLUSTER_NAME: ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} - UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} - if: ${{ matrix.credential == 'aws' }} + if: matrix.credential == 'aws' run: | curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp sudo mv /tmp/eksctl /usr/local/bin - eksctl create cluster --name $EKS_CLUSTER_NAME \ --nodes-min 1 --nodes-max 2 --node-type t3.large \ --managed \ - --region ${{ env.AWS_REGION }} \ - --tags application=$UNIQUE_APP_NAME \ - --tags environment=functional-test - + --region ${{ env.AWS_REGION }} while [[ "$(eksctl get cluster $EKS_CLUSTER_NAME --region ${{ env.AWS_REGION }} -o json | jq -r .[0].Status)" != "ACTIVE" ]]; do echo "Waiting for EKS cluster to be created..." sleep 60 @@ -131,38 +175,19 @@ jobs: done timeout-minutes: 60 continue-on-error: false - - name: Create Azure Resource Group - if: matrix.credential == 'azure' - env: - RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} - SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} - run: | - current_time=$(date +%s) - az group create \ - --location ${{ env.AZURE_LOCATION }} \ - --name $RESOURCE_GROUP \ - --subscription $SUBSCRIPTION_ID \ - --tags creationTime=$current_time \ - --tags environment=functional-test - while [ $(az group exists --name $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID) = false ]; do - echo "Waiting for resource group $RESOURCE_GROUP to be created..." - sleep 5 - done - name: Download k3d - if: matrix.credential != 'aws' + if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential != 'aws' run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash - name: Download rad CLI + if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - for attempt in 1 2 3; do + for attempt in 1 2 3 4 5; do if [[ -n "${{ inputs.version }}" ]]; then echo "Downloading rad CLI version ${{ inputs.version }}" - wget -q "https://get.radapp.dev/tools/rad/install.sh" -O - | /bin/bash -s ${{ inputs.version }} - elif [ "$BRANCH" = "edge" ]; then - echo "Downloading edge rad CLI" - wget -q "https://get.radapp.dev/tools/rad/install.sh" -O - | /bin/bash -s edge + wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s ${{ inputs.version }} else echo "Downloading latest rad CLI" - wget -q "https://get.radapp.dev/tools/rad/install.sh" -O - | /bin/bash + wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash fi if [ $? -eq 0 ]; then @@ -170,18 +195,20 @@ jobs: fi done - name: Create k3d cluster - if: matrix.credential != 'aws' - run: k3d cluster create -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" + if: steps.gen-id.outputs.RUN_TEST == 'true' + run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" - name: Install Dapr - if: matrix.enableDapr + if: steps.gen-id.outputs.RUN_TEST == 'true' && steps.gen-id.outputs.ENABLE_DAPR == 'true' run: | helm repo add dapr https://dapr.github.io/helm-charts/ helm install dapr dapr/dapr --version=1.6 --namespace dapr-system --create-namespace --wait - - name: Initialize Local Environment + - name: Initialize local environment + if: steps.gen-id.outputs.RUN_TEST == 'true' env: RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} run: | + rad install kubernetes --set rp.publicEndpointOverride=localhost if [[ "${{ matrix.credential }}" == "aws" ]]; then kubectl config current-context rad install kubernetes @@ -193,46 +220,25 @@ 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 radius.azurecr.io/recipes/dev/rediscaches:latest --link-type Applications.Link/redisCaches - rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/mongodatabases:latest --link-type Applications.Link/mongoDatabases - + rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/rediscaches:latest --link-type Applications.Datastores/redisCaches + rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/mongodatabases:latest --link-type Applications.Datastores/mongoDatabases if [[ "${{ matrix.credential }}" == "azure" ]]; then rad env update default --azure-subscription-id $SUBSCRIPTION_ID --azure-resource-group $RESOURCE_GROUP rad credential register azure --client-id ${{ secrets.AZURE_SP_TESTS_APPID }} --client-secret ${{ secrets.AZURE_SP_TESTS_PASSWORD }} --tenant-id ${{ secrets.AZURE_SP_TESTS_TENANTID }} fi - - if [[ "${{ matrix.credential }}" == "aws" ]]; then - rad env update default --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} - rad credential register aws \ - --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} - fi - - name: Deploy App - env: - EKS_CLUSTER_NAME: ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} - UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} - run: | - args="${{ matrix.path }} ${{ matrix.args }}" - if [[ "${{ matrix.credential }}" == "aws" ]]; then - args="$args -p eksClusterName=$EKS_CLUSTER_NAME -p appName=$UNIQUE_APP_NAME" - echo $args - fi - rad deploy $args - - name: Wait For All Pods To Be Ready - env: - UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} + # Deploy application and run tests + - name: Deploy app + if: steps.gen-id.outputs.RUN_TEST == 'true' + run: rad deploy ${{ matrix.path }} ${{ matrix.args }} + - name: Wait for all pods to be ready + if: steps.gen-id.outputs.RUN_TEST == 'true' run: | namespace="default-${{ matrix.app }}" label="radius.dev/application=${{ matrix.app }}" - if [[ "${{ matrix.credential }}" == "aws" ]]; then - namespace="default-$UNIQUE_APP_NAME" - label="radius.dev/application=$UNIQUE_APP_NAME" - fi kubectl wait --for=condition=Ready pod -l $label -n $namespace --timeout=5m - name: Run Playwright Test - env: - UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} id: run-playwright-test - if: matrix.uiTestFile != '' + if: matrix.uiTestFile != '' && steps.gen-id.outputs.RUN_TEST == 'true' run: | if [[ "${{ matrix.container }}" != "" ]]; then rad resource expose containers ${{ matrix.container }} ${{ matrix.args }} --port ${{ matrix.port }} & @@ -247,14 +253,24 @@ jobs: if [[ "${{ matrix.app }}" == "eshop" ]]; then endpoint="$(rad app status -a $app_name | sed 's/ /\n/g' | grep http)" echo $endpoint - ENDPOINT=$endpoint npx playwright test ${{ matrix.uiTestFile }} + ENDPOINT=$endpoint npx playwright test ${{ matrix.uiTestFile }} --retries 3 else - npx playwright test ${{ matrix.uiTestFile }} + npx playwright test ${{ matrix.uiTestFile }} --retries 3 fi - - name: Get Pod Logs For Failed Tests + - name: Upload Playwright Results + uses: actions/upload-artifact@v3 + if: always() && ( steps.run-playwright-test.outcome == 'success' || steps.run-playwright-test.outcome == 'failure' ) + with: + name: playwright-report-${{ matrix.name }} + path: ui-tests/playwright-report/ + retention-days: 30 + if-no-files-found: error + # Handle failures + - name: Get Pod logs for failed tests + id: get-pod-logs + if: failure() && steps.run-playwright-test.outcome == 'failure' env: UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} - if: failure() && matrix.uiTestFile != '' run: | # Create pod-logs directory mkdir -p ui-tests/pod-logs/${{ matrix.name }} @@ -270,33 +286,32 @@ jobs: kubectl logs $pod_name -n $namespace > ui-tests/pod-logs/${{ matrix.name }}/${pod_name}.txt done echo "Pod logs saved to ui-tests/pod-logs/${{ matrix.name }}/" - - name: Upload Playwright Results + # Get kubernetes events and save to file + kubectl get events -n $namespace > ui-tests/pod-logs/${{ matrix.name }}/events.txt + - name: Upload Pod logs for failed tests uses: actions/upload-artifact@v3 - if: always() && matrix.uiTestFile != '' - with: - name: playwright-report-${{ matrix.name }} - path: ui-tests/playwright-report/ - retention-days: 30 - if-no-files-found: error - - name: Upload Pod Logs - uses: actions/upload-artifact@v3 - if: failure() && matrix.uiTestFile != '' + if: failure() && steps.get-pod-logs.outcome == 'success' with: name: ${{ matrix.name }}-pod-logs path: ui-tests/pod-logs/${{ matrix.name }} retention-days: 30 if-no-files-found: error - - name: Delete App + - name: Create GitHub issue on failure + if: failure() && github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' + run: gh issue create --title "Samples deployment failed for ${{ matrix.app }}" --body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." --repo ${{ github.repository }} + # Cleanup + - name: Delete app env: UNIQUE_APP_NAME: ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} + if: steps.gen-id.outputs.RUN_TEST == 'true' run: | app_name=${{ matrix.app }} if [[ "${{ matrix.credential }}" == "aws" ]]; then app_name=$UNIQUE_APP_NAME fi rad app delete $app_name -y - - name: Delete Azure Resource Group - if: always() && matrix.credential == 'azure' + - name: Delete Azure resource group + if: always() && steps.create-azure-resource-group.outcome == 'success' env: RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} @@ -317,6 +332,7 @@ jobs: echo "Deleting EKS cluster: $EKS_CLUSTER_NAME" eksctl delete cluster --name $EKS_CLUSTER_NAME --region ${{ env.AWS_REGION }} --wait - name: Delete AWS Resources + if: always() && matrix.credential == 'aws' run: | ./.github/scripts/delete-aws-resources.sh ${{ steps.gen-id.outputs.TEST_UNIQUE_APP_NAME }} - name: Create GitHub issue on failure diff --git a/demo/app.bicep b/demo/app.bicep index 6ec8fbb3..5b7389ed 100644 --- a/demo/app.bicep +++ b/demo/app.bicep @@ -29,7 +29,7 @@ resource demo 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -resource db 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource db 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'db' properties: { application: application diff --git a/demo/client/src/routes/Index.tsx b/demo/client/src/routes/Index.tsx index f6e67051..7ed8020e 100644 --- a/demo/client/src/routes/Index.tsx +++ b/demo/client/src/routes/Index.tsx @@ -2,42 +2,131 @@ import { useLoaderData } from "react-router-dom"; export function Index() { const { process, env, network } = useLoaderData() as ContainerInfo; + + // Find all environment variables that start with npm_ + const connections = Object.entries(env).filter(([key, value]) => key.startsWith("CONNECTION_")); + // Now split the key into parts between _, and find all unique second parts + const uniqueConnections = Array.from(new Set(connections.map(([key, value]) => key.split("_")[1]))); + return <> -
-
-

Welcome to the Radius Demo

-
This page shows the configuration of the demo application.
- -
-

Network

-
-
Hostname:{network.hostname}
-
IPs:{network.ips.join(" ")}
-
Port:{network.port}
-
+ +
+ +
+
+

Welcome to the Radius demo

+

This demo container will showcase Radius features and configuration.

-
-

Process

-
-
Command:{process.args.join(" ")}
-
Working Directory:{process.pwd}
+
+ +
+
+

Radius Connections

+

See all the connections this container has to other resources within the application

+ + {uniqueConnections.length === 0 &&
No connections defined
} + +
+ { + uniqueConnections.map(connection => { + return
+

+ +

+
+
+
Environment variables
+

These environment variables are available to the container and are set automatically by Radius

+
    + {connections.filter(([key, value]) => key.startsWith(`CONNECTION_${connection}_`)).map(([key, value]) => { + return
  • {key}: {value}
  • + })} +
+
+
+
+ }) + }
+
-
-

Environment

-
- - - - - - - - {Object.entries(env).sort(([x], [y]) => x.localeCompare(y)).map(([key, value]) => { - return - })} -
KeyValue
{key}{value}
+
+ +
+
+

Container Metadata

+

Learn about the running container and its configuration

+ +
+
+

+ +

+
+
+
+
Hostname:{network.hostname}
+
IPs:{network.ips.join(" ")}
+
Port:{network.port}
+
+
+
+
+
+

+ +

+
+
+
+
Command:{process.args.join(" ")}
+
Working Directory:{process.pwd}
+
+
+
+
+
+

+ +

+
+
+
+ + + + + + + + + {Object.entries(env).sort(([x], [y]) => x.localeCompare(y)).map(([key, value]) => { + return + })} + +
KeyValue
{key}{value}
+
+
+
+
+ +
+
+ +
+
+

Todo List

+

Visit the Todo List page to try interacting with external dependencies

+
diff --git a/demo/package-lock.json b/demo/package-lock.json index 3aad854f..ec2b2583 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -12,6 +12,7 @@ "@types/mongodb": "^4.0.7", "@types/morgan": "^1.9.3", "@types/uuid": "^8.3.4", + "bootstrap": "^5.3.1", "dotenv": "^16.0.3", "express": "^4.18.2", "mongodb": "^4.11.0", @@ -1087,6 +1088,16 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, "node_modules/@redis/bloom": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz", @@ -1448,6 +1459,24 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/bootstrap": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.1.tgz", + "integrity": "sha512-jzwza3Yagduci2x0rr9MeFSORjcHpt0lRZukZPZQJT1Dth5qzV7XcgGqYzi39KGAVYR8QEDVoO0ubFKOxzMG+g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], + "peerDependencies": { + "@popperjs/core": "^2.11.8" + } + }, "node_modules/bowser": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", @@ -4006,6 +4035,12 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true + }, "@redis/bloom": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz", @@ -4309,6 +4344,12 @@ } } }, + "bootstrap": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.1.tgz", + "integrity": "sha512-jzwza3Yagduci2x0rr9MeFSORjcHpt0lRZukZPZQJT1Dth5qzV7XcgGqYzi39KGAVYR8QEDVoO0ubFKOxzMG+g==", + "requires": {} + }, "bowser": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", diff --git a/demo/package.json b/demo/package.json index 1a84f3f8..596f632c 100644 --- a/demo/package.json +++ b/demo/package.json @@ -26,6 +26,7 @@ "@types/mongodb": "^4.0.7", "@types/morgan": "^1.9.3", "@types/uuid": "^8.3.4", + "bootstrap": "^5.3.1", "dotenv": "^16.0.3", "express": "^4.18.2", "mongodb": "^4.11.0", diff --git a/quickstarts/dapr/dapr-azure.bicep b/quickstarts/dapr/dapr-azure.bicep index a993ee5a..e521d764 100644 --- a/quickstarts/dapr/dapr-azure.bicep +++ b/quickstarts/dapr/dapr-azure.bicep @@ -102,7 +102,7 @@ resource account 'Microsoft.Storage/storageAccounts@2019-06-01' = { } } -resource stateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { +resource stateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { environment: environment diff --git a/quickstarts/dapr/dapr.bicep b/quickstarts/dapr/dapr.bicep index 019861b7..19a6646b 100644 --- a/quickstarts/dapr/dapr.bicep +++ b/quickstarts/dapr/dapr.bicep @@ -85,7 +85,7 @@ resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' = { } } -resource stateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { +resource stateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { name: 'statestore' properties: { environment: environment diff --git a/quickstarts/environment-variables/app.bicep b/quickstarts/environment-variables/app.bicep index befc496f..eb473155 100644 --- a/quickstarts/environment-variables/app.bicep +++ b/quickstarts/environment-variables/app.bicep @@ -28,7 +28,7 @@ resource container 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -resource mongoLink 'Applications.Link/mongoDatabases@2022-03-15-privatepreview' = { +resource mongoLink 'Applications.Datastores/mongoDatabases@2022-03-15-privatepreview' = { name: 'mongo-link' properties: { environment: environment diff --git a/quickstarts/recipes/app.bicep b/quickstarts/recipes/app.bicep index aca893a6..8ec55aa6 100644 --- a/quickstarts/recipes/app.bicep +++ b/quickstarts/recipes/app.bicep @@ -26,8 +26,8 @@ resource frontend 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -// Redis Cache Link resource -resource db 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +// Redis Cache portable resource +resource db 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'db' properties: { environment: environment diff --git a/reference-apps/container-app-store/README.md b/reference-apps/container-app-store/README.md index 82f3aee4..e1a2bb95 100644 --- a/reference-apps/container-app-store/README.md +++ b/reference-apps/container-app-store/README.md @@ -12,7 +12,7 @@ This reference app is a "radified" version of the [Container Apps Store](https:/ 1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) 1. Clone the repository and switch to the app directory: ```bash - git clone https://github.com/project-radius/samples.git + git clone https://github.com/radius-project/samples.git cd samples/reference-apps/container-app-store ``` 1. Deploy the app: diff --git a/reference-apps/container-app-store/iac/infra-azure.bicep b/reference-apps/container-app-store/iac/infra-azure.bicep index ac469ca3..0bb9e530 100644 --- a/reference-apps/container-app-store/iac/infra-azure.bicep +++ b/reference-apps/container-app-store/iac/infra-azure.bicep @@ -23,7 +23,7 @@ resource account 'Microsoft.Storage/storageAccounts@2021-09-01' = { } } -resource statestore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { +resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { application: applicationId diff --git a/reference-apps/container-app-store/iac/infra-selfhosted.bicep b/reference-apps/container-app-store/iac/infra-selfhosted.bicep index e580bdd2..b72ae6e8 100644 --- a/reference-apps/container-app-store/iac/infra-selfhosted.bicep +++ b/reference-apps/container-app-store/iac/infra-selfhosted.bicep @@ -28,7 +28,7 @@ resource redisRoute 'Applications.Core/httpRoutes@2022-03-15-privatepreview' = { } } -resource statestore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { +resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { resourceProvisioning: 'manual' diff --git a/reference-apps/eshop-dapr/README.md b/reference-apps/eshop-dapr/README.md index 80252bce..4402865a 100644 --- a/reference-apps/eshop-dapr/README.md +++ b/reference-apps/eshop-dapr/README.md @@ -34,7 +34,7 @@ The current version of eShopOnDapr utilizes Azure Kubernetes Services to deploy 1. Clone the repository and switch to the app directory: ```bash - git clone https://github.com/project-radius/samples.git + git clone https://github.com/radius-project/samples.git cd samples/reference-apps/eshop-dapr ``` diff --git a/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep b/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep index c9b314ea..facebab1 100644 --- a/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep @@ -40,7 +40,7 @@ resource serviceBus 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = { // Create the Dapr pub sub component //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' = { +resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' = { name: 'eshopondapr-pubsub' location: 'global' properties: { diff --git a/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep b/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep index d7d24c9a..2c87fc82 100644 --- a/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep @@ -46,7 +46,7 @@ resource keyVault 'Microsoft.KeyVault/vaults@2021-11-01-preview' = { // Create the Dapr secret store component //----------------------------------------------------------------------------- -resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' = { +resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' = { name: 'eshopondapr-secretstore' location: 'global' properties: { diff --git a/reference-apps/eshop-dapr/infra/dapr-state-store.bicep b/reference-apps/eshop-dapr/infra/dapr-state-store.bicep index ca96b912..f6c400b4 100644 --- a/reference-apps/eshop-dapr/infra/dapr-state-store.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-state-store.bicep @@ -77,7 +77,7 @@ resource cosmosCollection 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/co // Create the Dapr state store component //----------------------------------------------------------------------------- -resource daprStateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { +resource daprStateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { name: 'eshopondapr-statestore' location: 'global' dependsOn: [ diff --git a/reference-apps/eshop-dapr/infra/sql-server.bicep b/reference-apps/eshop-dapr/infra/sql-server.bicep index f02b1b9a..6bbf7080 100644 --- a/reference-apps/eshop-dapr/infra/sql-server.bicep +++ b/reference-apps/eshop-dapr/infra/sql-server.bicep @@ -109,10 +109,10 @@ resource keyVault 'Microsoft.KeyVault/vaults@2021-11-01-preview' existing = { } //----------------------------------------------------------------------------- -// Create Radius links to the databases +// Create Radius portable resources to the databases //----------------------------------------------------------------------------- -resource catalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource catalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'catalog-db-link' properties: { application: appId @@ -129,7 +129,7 @@ resource catalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = } } -resource identityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource identityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identity-db-link' properties: { application: appId @@ -146,7 +146,7 @@ resource identityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = } } -resource orderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource orderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'ordering-db-link' properties: { application: appId diff --git a/reference-apps/eshop-dapr/services/basket-api.bicep b/reference-apps/eshop-dapr/services/basket-api.bicep index c73089b5..1977a7bd 100644 --- a/reference-apps/eshop-dapr/services/basket-api.bicep +++ b/reference-apps/eshop-dapr/services/basket-api.bicep @@ -36,11 +36,11 @@ resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing name: gatewayName } -resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprStateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' existing = { +resource daprStateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' existing = { name: daprStateStoreName } diff --git a/reference-apps/eshop-dapr/services/catalog-api.bicep b/reference-apps/eshop-dapr/services/catalog-api.bicep index f271946c..6f40b12e 100644 --- a/reference-apps/eshop-dapr/services/catalog-api.bicep +++ b/reference-apps/eshop-dapr/services/catalog-api.bicep @@ -6,7 +6,7 @@ param appId string @description('The name of the Catalog API HTTP route.') param catalogApiRouteName string -@description('The name of the Catalog database link.') +@description('The name of the Catalog database portable resource.') param catalogDbName string @description('The name of the Dapr pub/sub component.') @@ -33,15 +33,15 @@ resource catalogApiRoute 'Applications.Core/httproutes@2022-03-15-privatepreview name: catalogApiRouteName } -resource catalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource catalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: catalogDbName } -resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } diff --git a/reference-apps/eshop-dapr/services/identity-api.bicep b/reference-apps/eshop-dapr/services/identity-api.bicep index ad687cdb..805f5db5 100644 --- a/reference-apps/eshop-dapr/services/identity-api.bicep +++ b/reference-apps/eshop-dapr/services/identity-api.bicep @@ -13,7 +13,7 @@ param gatewayName string @description('The name of the Identity API HTTP route.') param identityApiRouteName string -@description('The name of the Identity database link.') +@description('The name of the Identity database portable resource.') param identityDbName string @description('The name of the Key Vault to get secrets from.') @@ -28,7 +28,7 @@ var daprAppId = 'identity-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } @@ -40,7 +40,7 @@ resource identityApiRoute 'Applications.Core/httproutes@2022-03-15-privateprevie name: identityApiRouteName } -resource identityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource identityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: identityDbName } diff --git a/reference-apps/eshop-dapr/services/ordering-api.bicep b/reference-apps/eshop-dapr/services/ordering-api.bicep index 9d5e9ef4..95708d81 100644 --- a/reference-apps/eshop-dapr/services/ordering-api.bicep +++ b/reference-apps/eshop-dapr/services/ordering-api.bicep @@ -22,7 +22,7 @@ param keyVaultName string @description('The name of the Ordering API HTTP route.') param orderingApiRouteName string -@description('The name of the Ordering database link.') +@description('The name of the Ordering database portable resource.') param orderingDbName string @description('The name of the Seq HTTP route.') @@ -35,11 +35,11 @@ var daprAppId = 'ordering-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } @@ -55,7 +55,7 @@ resource orderingApiRoute 'Applications.Core/httproutes@2022-03-15-privateprevie name: orderingApiRouteName } -resource orderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource orderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: orderingDbName } diff --git a/reference-apps/eshop-dapr/services/payment-api.bicep b/reference-apps/eshop-dapr/services/payment-api.bicep index 00e90f79..03a14a46 100644 --- a/reference-apps/eshop-dapr/services/payment-api.bicep +++ b/reference-apps/eshop-dapr/services/payment-api.bicep @@ -19,7 +19,7 @@ var daprAppId = 'payment-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } diff --git a/reference-apps/eshop/README.md b/reference-apps/eshop/README.md index 5b06a7ff..f858478c 100644 --- a/reference-apps/eshop/README.md +++ b/reference-apps/eshop/README.md @@ -14,7 +14,7 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) 1. Clone the repository and switch to the app directory: ```bash - git clone https://github.com/project-radius/samples.git + git clone https://github.com/radius-project/samples.git cd samples/reference-apps/eshop ``` 1. Deploy the app (choose which type of hosting infrastructure you wish to use): diff --git a/reference-apps/eshop/envoy/README.md b/reference-apps/eshop/envoy/README.md index d459ed4f..b542a623 100644 --- a/reference-apps/eshop/envoy/README.md +++ b/reference-apps/eshop/envoy/README.md @@ -1,6 +1,6 @@ # Envoy for eshop -Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. +Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/radius-project/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. diff --git a/reference-apps/eshop/iac/eshop.bicep b/reference-apps/eshop/iac/eshop.bicep index fb2233bc..49bfc0a4 100644 --- a/reference-apps/eshop/iac/eshop.bicep +++ b/reference-apps/eshop/iac/eshop.bicep @@ -98,7 +98,7 @@ module aws 'infra/aws.bicep' = if (platform == 'aws') { } } -// Links ----------------------------------------------------------- +// Portable Resources ----------------------------------------------------------- // TODO: Switch to Recipes once ready module links 'infra/links.bicep' = { @@ -280,7 +280,7 @@ module webshopping 'services/webshopping.bicep' = { } module webstatus 'services/webstatus.bicep' = { - name: 'websatatus' + name: 'webstatus' params: { application: eshop.id APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY diff --git a/reference-apps/eshop/iac/infra/aws.bicep b/reference-apps/eshop/iac/infra/aws.bicep index 3e2f4132..ea7124d2 100644 --- a/reference-apps/eshop/iac/infra/aws.bicep +++ b/reference-apps/eshop/iac/infra/aws.bicep @@ -240,10 +240,10 @@ resource rabbitmqRoute 'Applications.Core/httproutes@2022-03-15-privatepreview' } } -// Links ---------------------------------------------------------------------------- -// TODO: Move the Link definitions into the application and use Recipes instead +// Portable Resources ---------------------------------------------------------------------------- +// TODO: Move the portable resource definitions into the application and use Recipes instead -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identitydb' properties: { application: application @@ -260,7 +260,7 @@ resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'catalogdb' properties: { application: application @@ -277,7 +277,7 @@ resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' } } -resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'orderingdb' properties: { application: application @@ -294,7 +294,7 @@ resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'webhooksdb' properties: { application: application @@ -311,7 +311,7 @@ resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'keystore-data' properties: { application: application @@ -325,7 +325,7 @@ resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' } } -resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'basket-data' properties: { application: application @@ -339,38 +339,41 @@ resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = } } -resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepreview' = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = { name: 'eshop-event-bus' properties: { application: application environment: environment resourceProvisioning: 'manual' queue: 'eshop-event-bus' + host: rabbitmqRoute.properties.hostname + port: rabbitmqRoute.properties.port + username: 'guest' secrets: { - connectionString: rabbitmqRoute.properties.hostname + password: 'guest' } } } // Outputs ------------------------------------ -@description('The name of the SQL Identity Link') +@description('The name of the SQL Identity portable resource') output sqlIdentityDb string = sqlIdentityDb.name -@description('The name of the SQL Catalog Link') +@description('The name of the SQL Catalog portable resource') output sqlCatalogDb string = sqlCatalogDb.name -@description('The name of the SQL Ordering Link') +@description('The name of the SQL Ordering portable resource') output sqlOrderingDb string = sqlOrderingDb.name -@description('The name of the SQL Webhooks Link') +@description('The name of the SQL Webhooks portable resource') output sqlWebhooksDb string = sqlWebhooksDb.name -@description('The name of the Redis Keystore Link') +@description('The name of the Redis Keystore portable resource') output redisKeystore string = redisKeystore.name -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') output redisBasket string = redisBasket.name -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') output rabbitmq string = rabbitmq.name diff --git a/reference-apps/eshop/iac/infra/azure.bicep b/reference-apps/eshop/iac/infra/azure.bicep index fc1fe5e2..889a999f 100644 --- a/reference-apps/eshop/iac/infra/azure.bicep +++ b/reference-apps/eshop/iac/infra/azure.bicep @@ -235,24 +235,26 @@ resource basketCache 'Microsoft.Cache/redis@2020-12-01' = { } } -// Links ---------------------------------------------------------------------------- -// TODO: Move the Link definitions into the application and use Recipes instead +// Portable Resources ---------------------------------------------------------------------------- +// TODO: Move the portable resource definitions into the application and use Recipes instead // Need to deploy a blank rabbitmq instance to let Bicep successfully deploy -resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepreview' = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = { name: 'eshop-event-bus' properties: { application: application environment: environment resourceProvisioning: 'manual' queue: 'eshop-event-bus' + host: 'test' + port: 5672 secrets: { - connectionString: 'test' + uri: 'test' } } } -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identitydb' properties: { application: application @@ -274,7 +276,7 @@ resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'catalogdb' properties: { application: application @@ -296,7 +298,7 @@ resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' } } -resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'orderingdb' properties: { application: application @@ -318,7 +320,7 @@ resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'webhooksdb' properties: { application: application @@ -340,7 +342,7 @@ resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'basket-data' properties: { application: application @@ -355,7 +357,7 @@ resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = } } -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'keystore-data' properties: { application: application @@ -379,20 +381,20 @@ output serviceBusAuthConnectionString string = servicebus::topic::rootRule.listK @description('The name of the RabbitMQ Queue') output rabbitMqQueue string = rabbitmq.name -@description('The name of the SQL Identity Link') +@description('The name of the SQL Identity portable resource') output sqlIdentityDb string = sqlIdentityDb.name -@description('The name of the SQL Catalog Link') +@description('The name of the SQL Catalog portable resource') output sqlCatalogDb string = sqlCatalogDb.name -@description('The name of the SQL Ordering Link') +@description('The name of the SQL Ordering portable resource') output sqlOrderingDb string = sqlOrderingDb.name -@description('The name of the SQL Webhooks Link') +@description('The name of the SQL Webhooks portable resource') output sqlWebhooksDb string = sqlWebhooksDb.name -@description('The name of the Redis Keystore Link') +@description('The name of the Redis Keystore portable resource') output redisKeystore string = redisKeystore.name -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') output redisBasket string = redisBasket.name diff --git a/reference-apps/eshop/iac/infra/containers.bicep b/reference-apps/eshop/iac/infra/containers.bicep index 52c493f5..d94ac598 100644 --- a/reference-apps/eshop/iac/infra/containers.bicep +++ b/reference-apps/eshop/iac/infra/containers.bicep @@ -205,22 +205,25 @@ resource redisKeystoreRoute 'Applications.Core/httproutes@2022-03-15-privateprev } } -// Links --------------------------------------------------------------- +// Portable Resources --------------------------------------------------------------- -resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepreview' = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = { name: 'eshop-event-bus' properties: { application: application environment: environment resourceProvisioning: 'manual' queue: 'eshop-event-bus' + host: rabbitmqRoute.properties.hostname + port: rabbitmqRoute.properties.port + username: 'guest' secrets: { - connectionString: rabbitmqRoute.properties.hostname + password: 'guest' } } } -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identitydb' properties: { application: application @@ -237,7 +240,7 @@ resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'catalogdb' properties: { application: application @@ -254,7 +257,7 @@ resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' } } -resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'orderingdb' properties: { application: application @@ -271,7 +274,7 @@ resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'webhooksdb' properties: { application: application @@ -288,7 +291,7 @@ resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview } } -resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'basket-data' properties: { application: application @@ -302,7 +305,7 @@ resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' = } } -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { name: 'keystore-data' properties: { application: application @@ -318,23 +321,23 @@ resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' // Outputs ------------------------------------ -@description('The name of the SQL Identity Link') +@description('The name of the SQL Identity portable resource') output sqlIdentityDb string = sqlIdentityDb.name -@description('The name of the SQL Catalog Link') +@description('The name of the SQL Catalog portable resource') output sqlCatalogDb string = sqlCatalogDb.name -@description('The name of the SQL Ordering Link') +@description('The name of the SQL Ordering portable resource') output sqlOrderingDb string = sqlOrderingDb.name -@description('The name of the SQL Webhooks Link') +@description('The name of the SQL Webhooks portable resource') output sqlWebhooksDb string = sqlWebhooksDb.name -@description('The name of the Redis Keystore Link') +@description('The name of the Redis Keystore portable resource') output redisKeystore string = redisKeystore.name -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') output redisBasket string = redisBasket.name -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') output rabbitmq string = rabbitmq.name diff --git a/reference-apps/eshop/iac/infra/links.bicep b/reference-apps/eshop/iac/infra/links.bicep index f1685f07..03646c43 100644 --- a/reference-apps/eshop/iac/infra/links.bicep +++ b/reference-apps/eshop/iac/infra/links.bicep @@ -1,30 +1,30 @@ import radius as rad -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: 'identitydb' } -resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: 'catalogdb' } -resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: 'orderingdb' } -resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: 'webhooksdb' } -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: 'keystore-data' } -resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: 'basket-data' } -resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: 'eshop-event-bus' } diff --git a/reference-apps/eshop/iac/services/basket.bicep b/reference-apps/eshop/iac/services/basket.bicep index 6edcf478..58aaeff8 100644 --- a/reference-apps/eshop/iac/services/basket.bicep +++ b/reference-apps/eshop/iac/services/basket.bicep @@ -36,10 +36,10 @@ param basketHttpName string @description('The name of the Basket gRPC Route') param basketGrpcName string -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') param redisBasketName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string @description('The connection string of the Azure Service Bus') @@ -66,7 +66,7 @@ resource basket 'Applications.Core/containers@2022-03-15-privatepreview' = { GRPC_PORT: '81' AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: redisBasket.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -112,12 +112,12 @@ resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' exi name: basketGrpcName } -// Links ------------------------------------------ +// Portable Resource ------------------------------------------ -resource redisBasket 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisBasketName } -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/reference-apps/eshop/iac/services/catalog.bicep b/reference-apps/eshop/iac/services/catalog.bicep index 930f8866..0ae9712b 100644 --- a/reference-apps/eshop/iac/services/catalog.bicep +++ b/reference-apps/eshop/iac/services/catalog.bicep @@ -40,10 +40,10 @@ param catalogHttpName string @description('The name of the Catalog gRPC Route') param catalogGrpcName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string -@description('The name of the Catalog SQL Link') +@description('The name of the Catalog SQL portable resource') param sqlCatalogDbName string @description('The connection string of the Azure Service Bus') @@ -74,7 +74,7 @@ resource catalog 'Applications.Core/containers@2022-03-15-privatepreview' = { ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlCatalogDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host } ports: { http: { @@ -109,12 +109,12 @@ resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' ex name: catalogGrpcName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- -resource sqlCatalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlCatalogDbName } -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/reference-apps/eshop/iac/services/identity.bicep b/reference-apps/eshop/iac/services/identity.bicep index a4cd2c4a..58e515bb 100644 --- a/reference-apps/eshop/iac/services/identity.bicep +++ b/reference-apps/eshop/iac/services/identity.bicep @@ -42,10 +42,10 @@ param webhooksclientHttpName string @description('Name of the WebMVC HTTP Route') param webmvcHttpName string -@description('Name of the Identity SQL Database Link') +@description('Name of the Identity SQL Database portable resource') param sqlIdentityDbName string -@description('Name of the Keystore Redis Link') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string // CONTAINERS ------------------------------------------------------------------- @@ -154,12 +154,12 @@ resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' exi name: webmvcHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlIdentityDbName } -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisKeystoreName } diff --git a/reference-apps/eshop/iac/services/ordering.bicep b/reference-apps/eshop/iac/services/ordering.bicep index dbeef5ea..94a83720 100644 --- a/reference-apps/eshop/iac/services/ordering.bicep +++ b/reference-apps/eshop/iac/services/ordering.bicep @@ -48,13 +48,13 @@ param orderingsignalrhubHttpName string @description('Name of the Ordering background tasks HTTP Route') param orderbgtasksHttpName string -@description('Name of the Keystore Redis Link') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string -@description('Name of the Ordering SQL Link') +@description('Name of the Ordering SQL portable resource') param sqlOrderingDbName string @description('The connection string of the Azure Service Bus') @@ -85,7 +85,7 @@ resource ordering 'Applications.Core/containers@2022-03-15-privatepreview' = { GRPC_PORT: '81' PORT: '80' ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -132,7 +132,7 @@ resource orderbgtasks 'Applications.Core/containers@2022-03-15-privatepreview' = OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host } ports: { http: { @@ -165,7 +165,7 @@ resource orderingsignalrhub 'Applications.Core/containers@2022-03-15-privateprev OrchestratorType: ORCHESTRATOR_TYPE IsClusterEnv: 'True' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host SignalrStoreConnectionString: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.password()},abortConnect=False' identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' @@ -236,16 +236,16 @@ resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privateprevie name: orderbgtasksHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisKeystoreName } -resource sqlOrderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlOrderingDbName } -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/reference-apps/eshop/iac/services/payment.bicep b/reference-apps/eshop/iac/services/payment.bicep index 372aa5b2..03448ea4 100644 --- a/reference-apps/eshop/iac/services/payment.bicep +++ b/reference-apps/eshop/iac/services/payment.bicep @@ -27,7 +27,7 @@ param TAG string @description('Name of the Payment HTTP route') param paymentHttpName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string @description('The connection string of the Azure Service Bus') @@ -49,7 +49,7 @@ resource payment 'Applications.Core/containers@2022-03-15-privatepreview' = { 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host } ports: { http: { @@ -67,8 +67,8 @@ resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' ex name: paymentHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/reference-apps/eshop/iac/services/web.bicep b/reference-apps/eshop/iac/services/web.bicep index 895ab74e..de1cb7e6 100644 --- a/reference-apps/eshop/iac/services/web.bicep +++ b/reference-apps/eshop/iac/services/web.bicep @@ -38,7 +38,7 @@ param webshoppingaggHttpName string @description('Web shopping API GW HTTP Route name') param webshoppingapigwHttpName string -@description('Name of the Keystore Redis Link name') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string // CONTAINER -------------------------------------------------------------------- @@ -183,8 +183,8 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepr name: webshoppingapigwHttpName } -// LINKS ------------------------------------------------------ +// PORTABLE RESOURCES ------------------------------------------------------ -resource redisKeystore 'Applications.Link/redisCaches@2022-03-15-privatepreview' existing = { +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisKeystoreName } diff --git a/reference-apps/eshop/iac/services/webhooks.bicep b/reference-apps/eshop/iac/services/webhooks.bicep index 4cd71ad0..dd1fbdc3 100644 --- a/reference-apps/eshop/iac/services/webhooks.bicep +++ b/reference-apps/eshop/iac/services/webhooks.bicep @@ -33,10 +33,10 @@ param webhooksHttpName string @description('Name of the WebhooksClient HTTP Route') param webhooksclientHttpName string -@description('The name of the Webhooks SQL Link') +@description('The name of the Webhooks SQL portable resource') param sqlWebhooksDbName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string @description('The connection string of the Azure Service Bus') @@ -59,7 +59,7 @@ resource webhooks 'Applications.Core/containers@2022-03-15-privatepreview' = { OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlWebhooksDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.connectionString() + EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -137,12 +137,12 @@ resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privateprev name: webhooksclientHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- -resource sqlWebhooksDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlWebhooksDbName } -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/reference-apps/eshop/iac/services/webshopping.bicep b/reference-apps/eshop/iac/services/webshopping.bicep index ad9d80e0..4571a273 100644 --- a/reference-apps/eshop/iac/services/webshopping.bicep +++ b/reference-apps/eshop/iac/services/webshopping.bicep @@ -50,7 +50,7 @@ param webshoppingapigwHttp2Name string @description('Web Shopping Aggregator Http Route name') param webshoppingaggHttpName string -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') param rabbitmqName string // Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webshoppingagg @@ -184,8 +184,8 @@ resource webshoppingapigwHttp2 'Applications.Core/httpRoutes@2022-03-15-privatep name: webshoppingapigwHttp2Name } -// LINKS -------------------------------------------------------- +// PORTABLE RESOURCES -------------------------------------------------------- -resource rabbitmq 'Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview' existing = { +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { name: rabbitmqName } diff --git a/ui-tests/tests/demo.app.spec.ts b/ui-tests/tests/demo.app.spec.ts index 9e786ff7..1d69fa67 100644 --- a/ui-tests/tests/demo.app.spec.ts +++ b/ui-tests/tests/demo.app.spec.ts @@ -38,13 +38,12 @@ test("To-Do App Basic UI Checks", async ({ page }) => { await page.getByRole("link", { name: "Radius Demo" }) .click(); + await page.getByRole('button', { name: '📄 Environment variables' }).click(); + // Make sure important environment variables are visible - await expect(page.getByText("CONNECTION_REDIS_CONNECTIONSTRING")) - .toBeVisible(); - await expect(page.getByText("CONNECTION_REDIS_HOST")) - .toBeVisible(); - await expect(page.getByText("CONNECTION_REDIS_PORT")) - .toBeVisible(); + await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_CONNECTIONSTRING' }).getByText('CONNECTION_REDIS_CONNECTIONSTRING')).toBeVisible(); + await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_HOST' }).getByText('CONNECTION_REDIS_HOST')).toBeVisible(); + await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_PORT' }).getByText('CONNECTION_REDIS_PORT')).toBeVisible(); }); test("Add an item and check basic functionality", async ({ page }) => {