From ff9ec1ca684848c650680f09099b6363733be03d Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 27 Jul 2023 17:50:26 -0700 Subject: [PATCH 01/16] Adding workflow dispatch to kick off automated samples validation (#422) * Adding workflow dispatch to start samples validation * Syntax * More syntax * Adding validation for semver * Fixing semver --- .github/scripts/validate_semver.py | 45 ++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 19 +++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100755 .github/scripts/validate_semver.py diff --git a/.github/scripts/validate_semver.py b/.github/scripts/validate_semver.py new file mode 100755 index 00000000..7f182606 --- /dev/null +++ b/.github/scripts/validate_semver.py @@ -0,0 +1,45 @@ +# ------------------------------------------------------------ +# 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. +# ------------------------------------------------------------ + +# This script validates that the provided version is a valid semver + +import os +import re +import sys + +def main(): + if len(sys.argv) != 2: + print("Usage: validate_semver.py ") + sys.exit(1) + + # From https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + 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: + print("Provided version is not valid semver") + sys.exit(1) + else: + print("Provided version is valid semver") + sys.exit(0) + +if __name__ == "__main__": + main() diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fb3bf78b..20879c36 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,6 +2,12 @@ name: Test Quickstarts on: workflow_dispatch: + inputs: + version: + description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' + required: false + default: '' + type: string push: branches: - v*.* @@ -71,6 +77,10 @@ jobs: echo "TEST_RESOURCE_GROUP_PREFIX=samplestest-${UNIQUE_ID}" >> $GITHUB_OUTPUT - name: Checkout code uses: actions/checkout@v3 + - name: Ensure inputs.version is valid semver + if: inputs.version != '' + run: | + ./scripts/validate-version.sh ${{ inputs.version }} - name: Setup Node uses: actions/setup-node@v3 with: @@ -102,12 +112,17 @@ jobs: - name: Download rad CLI run: | for attempt in 1 2 3; do - echo "Downloading rad CLI from branch $BRANCH" - if [ "$BRANCH" = "edge" ]; then + 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 else + echo "Downloading latest rad CLI" wget -q "https://get.radapp.dev/tools/rad/install.sh" -O - | /bin/bash fi + if [ $? -eq 0 ]; then break fi From fa42f57e59976903247a02688fc579c75f340f4f Mon Sep 17 00:00:00 2001 From: nithyatsu <98416062+nithyatsu@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:04:03 -0700 Subject: [PATCH 02/16] add .gitattributes (#442) --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes 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 From 14619b5e364f34fac722cca4acdf3d3490d7e7cd Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath <100623239+vishwahiremat@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:18:35 -0700 Subject: [PATCH 03/16] updating rabbitmq schema (#419) Co-authored-by: Aaron Crawfis --- reference-apps/eshop/iac/infra/aws.bicep | 5 ++++- reference-apps/eshop/iac/infra/containers.bicep | 5 ++++- reference-apps/eshop/iac/services/basket.bicep | 2 +- reference-apps/eshop/iac/services/catalog.bicep | 2 +- reference-apps/eshop/iac/services/ordering.bicep | 6 +++--- reference-apps/eshop/iac/services/payment.bicep | 2 +- reference-apps/eshop/iac/services/webhooks.bicep | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/reference-apps/eshop/iac/infra/aws.bicep b/reference-apps/eshop/iac/infra/aws.bicep index 0c208a99..75d814da 100644 --- a/reference-apps/eshop/iac/infra/aws.bicep +++ b/reference-apps/eshop/iac/infra/aws.bicep @@ -295,8 +295,11 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre 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' } } } diff --git a/reference-apps/eshop/iac/infra/containers.bicep b/reference-apps/eshop/iac/infra/containers.bicep index 52c493f5..e7b0a61a 100644 --- a/reference-apps/eshop/iac/infra/containers.bicep +++ b/reference-apps/eshop/iac/infra/containers.bicep @@ -214,8 +214,11 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre 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' } } } diff --git a/reference-apps/eshop/iac/services/basket.bicep b/reference-apps/eshop/iac/services/basket.bicep index 6edcf478..18b6baa9 100644 --- a/reference-apps/eshop/iac/services/basket.bicep +++ b/reference-apps/eshop/iac/services/basket.bicep @@ -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}' } diff --git a/reference-apps/eshop/iac/services/catalog.bicep b/reference-apps/eshop/iac/services/catalog.bicep index 930f8866..75995842 100644 --- a/reference-apps/eshop/iac/services/catalog.bicep +++ b/reference-apps/eshop/iac/services/catalog.bicep @@ -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: { diff --git a/reference-apps/eshop/iac/services/ordering.bicep b/reference-apps/eshop/iac/services/ordering.bicep index dbeef5ea..7abf1d8d 100644 --- a/reference-apps/eshop/iac/services/ordering.bicep +++ b/reference-apps/eshop/iac/services/ordering.bicep @@ -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}' diff --git a/reference-apps/eshop/iac/services/payment.bicep b/reference-apps/eshop/iac/services/payment.bicep index 372aa5b2..251bf16d 100644 --- a/reference-apps/eshop/iac/services/payment.bicep +++ b/reference-apps/eshop/iac/services/payment.bicep @@ -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: { diff --git a/reference-apps/eshop/iac/services/webhooks.bicep b/reference-apps/eshop/iac/services/webhooks.bicep index 4cd71ad0..ac502add 100644 --- a/reference-apps/eshop/iac/services/webhooks.bicep +++ b/reference-apps/eshop/iac/services/webhooks.bicep @@ -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}' } From 3139a620973b3ea18cadc2176072a907db9b52e8 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Mon, 7 Aug 2023 16:09:01 -0700 Subject: [PATCH 04/16] Move to samples runner --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 94f1ddaa..42b0b715 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,9 +20,9 @@ on: jobs: test: - name: Deploy quickstarts to local environment + name: Sample tests if: github.event.action != 'closed' - runs-on: [self-hosted, 1ES.Pool=1ES-Radius] + runs-on: [self-hosted, 1ES.Pool=1ES-Radius-Samples] strategy: fail-fast: false matrix: From 4f31d790cb853a9264216bf3d83ea902831fea94 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 14 Aug 2023 14:17:48 -0700 Subject: [PATCH 05/16] Publish GHCR and ACR side by side (#438) * use ghcr * wip * push * fix * reverted * wip --------- Co-authored-by: Aaron Crawfis --- .github/workflows/build.yaml | 154 +++++++++++++++++++++++++++-------- .github/workflows/test.yaml | 9 +- 2 files changed, 126 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 40c436e0..eaac8233 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/project-radius/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/project-radius/dev' || 'ghcr.io/project-radius/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/project-radius/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/project-radius/samples/issues/439 cleanup: name: Cleanup ${{ matrix.image }} if: github.event.action == 'closed' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9b7f180b..b6638cb0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,7 +23,8 @@ 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: Sample tests @@ -114,13 +115,13 @@ jobs: for attempt in 1 2 3; 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 }} + wget -q "${{ env.RAD_CLI_URL }}" -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 edge 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 From 99e111fc906398d0659a25c7d7aa06864da14fc9 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 17 Aug 2023 13:45:55 -0700 Subject: [PATCH 06/16] Fix test workflow (#469) * Updating test workflow --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b6638cb0..4698513e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -81,7 +81,7 @@ jobs: - name: Ensure inputs.version is valid semver if: inputs.version != '' run: | - ./scripts/validate-version.sh ${{ inputs.version }} + python ./.github/scripts/validate_semver.py ${{ inputs.version }} - name: Setup Node uses: actions/setup-node@v3 with: From ac1ebf4cf8d5fac16ec76cf9195a223c32c86279 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 17 Aug 2023 15:40:53 -0700 Subject: [PATCH 07/16] Fixing azure eshop (#489) --- reference-apps/eshop/iac/infra/azure.bicep | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference-apps/eshop/iac/infra/azure.bicep b/reference-apps/eshop/iac/infra/azure.bicep index fc1fe5e2..8f02bfc6 100644 --- a/reference-apps/eshop/iac/infra/azure.bicep +++ b/reference-apps/eshop/iac/infra/azure.bicep @@ -246,8 +246,10 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre environment: environment resourceProvisioning: 'manual' queue: 'eshop-event-bus' + host: 'test' + port: 5672 secrets: { - connectionString: 'test' + uri: 'test' } } } From fd8472673335520ef0dd63c44e3a961330b1f053 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Aug 2023 17:09:43 -0700 Subject: [PATCH 08/16] Add samples release automation (#499) * Adding samples release automation * bug * nit * nit * nit * PR * PR * PR --- .github/scripts/release-samples.sh | 42 +++++++++++++++++++++++++ .github/workflows/release.yaml | 49 ++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100755 .github/scripts/release-samples.sh create mode 100644 .github/workflows/release.yaml 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/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..714a1e58 --- /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/project-radius/samples \ + -f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' From 0972bc5e85be1b089108cf0d5724249cc573e055 Mon Sep 17 00:00:00 2001 From: Yetkin Timocin Date: Fri, 25 Aug 2023 16:37:46 -0700 Subject: [PATCH 09/16] Fixing ERR_EMPTY_RESPONSE in playwright tests (#527) --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4698513e..9373bb3c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -112,7 +112,7 @@ jobs: run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash - name: Download rad CLI 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 "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s ${{ inputs.version }} @@ -129,7 +129,7 @@ jobs: fi done - name: Create k3d cluster - run: k3d cluster create -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" + run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" - name: Install Dapr if: ${{ matrix.enableDapr }} run: | @@ -169,7 +169,7 @@ jobs: cd ui-tests/ npm ci npx playwright install --with-deps - npx playwright test ${{ matrix.uiTestFile }} + npx playwright test ${{ matrix.uiTestFile }} --retries=3 - name: Get Pod Logs For Failed Tests if: failure() && matrix.uiTestFile != '' run: | From 427b1f5f9f70b9407ae84a538f4ac6f9f33fe38e Mon Sep 17 00:00:00 2001 From: Will Smith Date: Mon, 28 Aug 2023 10:53:23 -0700 Subject: [PATCH 10/16] Removing workflow dispatch from gh issue creation (#529) --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9373bb3c..0138ece5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -213,5 +213,5 @@ jobs: --name $RESOURCE_GROUP \ --yes - name: Create GitHub issue on failure - if: failure() && github.event_name != 'pull_request' + 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 }} From d4d72b306172896f8790ac0e5f042ea138db7a42 Mon Sep 17 00:00:00 2001 From: Lakshmi Javadekar <103459615+lakshmimsft@users.noreply.github.com> Date: Wed, 30 Aug 2023 12:28:55 -0700 Subject: [PATCH 11/16] renaming Applications.Link resources to new types (#520) --- .github/workflows/test.yaml | 4 +-- demo/app.bicep | 2 +- quickstarts/dapr/dapr-azure.bicep | 2 +- quickstarts/dapr/dapr.bicep | 2 +- quickstarts/environment-variables/app.bicep | 2 +- quickstarts/recipes/app.bicep | 4 +-- .../container-app-store/iac/infra-azure.bicep | 2 +- .../iac/infra-selfhosted.bicep | 2 +- .../eshop-dapr/infra/dapr-pub-sub.bicep | 2 +- .../eshop-dapr/infra/dapr-secret-store.bicep | 2 +- .../eshop-dapr/infra/dapr-state-store.bicep | 2 +- .../eshop-dapr/infra/sql-server.bicep | 8 ++--- .../eshop-dapr/services/basket-api.bicep | 4 +-- .../eshop-dapr/services/catalog-api.bicep | 8 ++--- .../eshop-dapr/services/identity-api.bicep | 6 ++-- .../eshop-dapr/services/ordering-api.bicep | 8 ++--- .../eshop-dapr/services/payment-api.bicep | 2 +- reference-apps/eshop/iac/eshop.bicep | 2 +- reference-apps/eshop/iac/infra/aws.bicep | 32 +++++++++---------- reference-apps/eshop/iac/infra/azure.bicep | 30 ++++++++--------- .../eshop/iac/infra/containers.bicep | 30 ++++++++--------- reference-apps/eshop/iac/infra/links.bicep | 14 ++++---- .../eshop/iac/services/basket.bicep | 10 +++--- .../eshop/iac/services/catalog.bicep | 10 +++--- .../eshop/iac/services/identity.bicep | 10 +++--- .../eshop/iac/services/ordering.bicep | 14 ++++---- .../eshop/iac/services/payment.bicep | 6 ++-- reference-apps/eshop/iac/services/web.bicep | 6 ++-- .../eshop/iac/services/webhooks.bicep | 10 +++--- .../eshop/iac/services/webshopping.bicep | 6 ++-- 30 files changed, 121 insertions(+), 121 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0138ece5..67f9dbfa 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -146,8 +146,8 @@ 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 }} 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/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/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/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/iac/eshop.bicep b/reference-apps/eshop/iac/eshop.bicep index aec6fb5b..e28ae7ba 100644 --- a/reference-apps/eshop/iac/eshop.bicep +++ b/reference-apps/eshop/iac/eshop.bicep @@ -97,7 +97,7 @@ module aws 'infra/aws.bicep' = if (platform == 'aws') { } } -// Links ----------------------------------------------------------- +// Portable Resources ----------------------------------------------------------- // TODO: Switch to Recipes once ready module links 'infra/links.bicep' = { diff --git a/reference-apps/eshop/iac/infra/aws.bicep b/reference-apps/eshop/iac/infra/aws.bicep index 75d814da..2464593c 100644 --- a/reference-apps/eshop/iac/infra/aws.bicep +++ b/reference-apps/eshop/iac/infra/aws.bicep @@ -189,10 +189,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 @@ -209,7 +209,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 @@ -226,7 +226,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 @@ -243,7 +243,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 @@ -260,7 +260,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 @@ -274,7 +274,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 @@ -288,7 +288,7 @@ 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 @@ -306,23 +306,23 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre // 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 8f02bfc6..889a999f 100644 --- a/reference-apps/eshop/iac/infra/azure.bicep +++ b/reference-apps/eshop/iac/infra/azure.bicep @@ -235,11 +235,11 @@ 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 @@ -254,7 +254,7 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre } } -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identitydb' properties: { application: application @@ -276,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 @@ -298,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 @@ -320,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 @@ -342,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 @@ -357,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 @@ -381,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 e7b0a61a..d94ac598 100644 --- a/reference-apps/eshop/iac/infra/containers.bicep +++ b/reference-apps/eshop/iac/infra/containers.bicep @@ -205,9 +205,9 @@ 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 @@ -223,7 +223,7 @@ resource rabbitmq 'Applications.Link/rabbitmqMessageQueues@2022-03-15-privatepre } } -resource sqlIdentityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { name: 'identitydb' properties: { application: application @@ -240,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 @@ -257,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 @@ -274,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 @@ -291,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 @@ -305,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 @@ -321,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 18b6baa9..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') @@ -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 75995842..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') @@ -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 7abf1d8d..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') @@ -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 251bf16d..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') @@ -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 ac502add..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') @@ -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 } From 2aa14864d7393ed1929f7635d8d9e62f542bc7c2 Mon Sep 17 00:00:00 2001 From: Yetkin Timocin Date: Wed, 30 Aug 2023 12:38:47 -0700 Subject: [PATCH 12/16] Update eshop.bicep (#538) websatatus -> webstatus --- reference-apps/eshop/iac/eshop.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference-apps/eshop/iac/eshop.bicep b/reference-apps/eshop/iac/eshop.bicep index e28ae7ba..9aaa2ec9 100644 --- a/reference-apps/eshop/iac/eshop.bicep +++ b/reference-apps/eshop/iac/eshop.bicep @@ -279,7 +279,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 From 4900e001bccbb68dee0d38a9466573ee9f87486f Mon Sep 17 00:00:00 2001 From: nithyatsu <98416062+nithyatsu@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:28:05 -0700 Subject: [PATCH 13/16] renaming (#500) Co-authored-by: Aaron Crawfis --- .github/CODEOWNERS | 2 +- .github/workflows/build.yaml | 8 ++++---- .github/workflows/issues.yaml | 4 ++-- .github/workflows/release.yaml | 2 +- reference-apps/container-app-store/README.md | 2 +- reference-apps/eshop-dapr/README.md | 2 +- reference-apps/eshop/README.md | 2 +- reference-apps/eshop/envoy/README.md | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) 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/workflows/build.yaml b/.github/workflows/build.yaml index eaac8233..ca161af9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,15 +19,15 @@ 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/project-radius/samples/issues/439 + # 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/project-radius/dev' || 'ghcr.io/project-radius/samples' }} + 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/project-radius/samples/issues/439 + # TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/radius-project/samples/issues/439 build: name: Build and push sample images to ACR if: github.event.action != 'closed' @@ -154,7 +154,7 @@ jobs: 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/project-radius/samples/issues/439 + # 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 5f071ff0..e0dccd94 100644 --- a/.github/workflows/issues.yaml +++ b/.github/workflows/issues.yaml @@ -17,8 +17,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/release.yaml b/.github/workflows/release.yaml index 714a1e58..ff2489ac 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -45,5 +45,5 @@ jobs: --method PATCH \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/project-radius/samples \ + /repos/radius-project/samples \ -f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' 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/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/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*. From ff605cdbaebfe9525dc6a2595a92837ba4f5126a Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Tue, 5 Sep 2023 16:33:16 -0700 Subject: [PATCH 14/16] Update demo app UI (#544) * Add bootstrap * Add connections and new UI * Update casing * Update key string * Update string * Add delimiter * Add expand click --- demo/client/src/routes/Index.tsx | 151 ++++++++++++++++++++++++------- demo/package-lock.json | 41 +++++++++ demo/package.json | 1 + ui-tests/tests/demo.app.spec.ts | 2 + 4 files changed, 164 insertions(+), 31 deletions(-) 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/ui-tests/tests/demo.app.spec.ts b/ui-tests/tests/demo.app.spec.ts index 9e786ff7..c326ceb7 100644 --- a/ui-tests/tests/demo.app.spec.ts +++ b/ui-tests/tests/demo.app.spec.ts @@ -38,6 +38,8 @@ 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(); From 8c1ae1e1605918c52aa83c3e74cf7f1807b4cff3 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Tue, 5 Sep 2023 16:44:50 -0700 Subject: [PATCH 15/16] Update identifiers --- ui-tests/tests/demo.app.spec.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ui-tests/tests/demo.app.spec.ts b/ui-tests/tests/demo.app.spec.ts index 9e786ff7..21fd77cc 100644 --- a/ui-tests/tests/demo.app.spec.ts +++ b/ui-tests/tests/demo.app.spec.ts @@ -39,12 +39,9 @@ test("To-Do App Basic UI Checks", async ({ page }) => { .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 }) => { From 3629c82a189d71d4b28993b05cb1742202f7018a Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Thu, 7 Sep 2023 10:31:11 -0700 Subject: [PATCH 16/16] Remove Azure eshop from PR tests (#547) * Update semver checking * Add condition to Azure test * Add conditional logic * Update conditional logic * Explicitly disable Dapr * Add explicit check * Remove Dapr check * Move Dapr logic to setup step --- .github/scripts/validate_semver.py | 9 +-- .github/workflows/test.yaml | 95 +++++++++++++++++++++--------- 2 files changed, 73 insertions(+), 31 deletions(-) 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/test.yaml b/.github/workflows/test.yaml index 67f9dbfa..11a07d9f 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] @@ -28,72 +29,102 @@ env: jobs: test: name: Sample tests - if: github.event.action != 'closed' 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 env: BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} AZURE_LOCATION: westus3 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 "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: | 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 + 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 - if: matrix.credential == 'azure' + 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 }} @@ -109,16 +140,15 @@ jobs: sleep 5 done - name: Download k3d + if: steps.gen-id.outputs.RUN_TEST == 'true' 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 4 5; do if [[ -n "${{ inputs.version }}" ]]; then echo "Downloading rad CLI version ${{ inputs.version }}" wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s ${{ inputs.version }} - elif [ "$BRANCH" = "edge" ]; then - echo "Downloading edge rad CLI" - wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s edge else echo "Downloading latest rad CLI" wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash @@ -129,13 +159,15 @@ jobs: fi done - name: Create k3d cluster + 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: Init 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 }} @@ -152,16 +184,19 @@ jobs: 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 + # 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 }}" kubectl wait --for=condition=Ready pod -l $label -n $namespace --timeout=5m - name: Run Playwright Test 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 }} & @@ -170,8 +205,18 @@ jobs: npm ci npx playwright install --with-deps npx playwright test ${{ matrix.uiTestFile }} --retries=3 - - name: Get Pod Logs For Failed Tests - if: failure() && matrix.uiTestFile != '' + - 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' run: | # Create pod-logs directory mkdir -p ui-tests/pod-logs/${{ matrix.name }} @@ -183,26 +228,25 @@ 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: 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 + if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad app delete ${{ matrix.app }} -y - name: Delete Azure resource group - if: always() && matrix.credential == 'azure' + 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 }} @@ -212,6 +256,3 @@ jobs: --subscription $SUBSCRIPTION_ID \ --name $RESOURCE_GROUP \ --yes - - 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 }}