From c7a47c1b11089ae7b5ffb7c7208237c831a9a1e4 Mon Sep 17 00:00:00 2001 From: Shruthi Kumar Date: Mon, 12 Aug 2024 15:09:38 -0700 Subject: [PATCH 01/12] Update bicep references (#1645) * update bicep references Signed-off-by: sk593 * nit Signed-off-by: sk593 * nit Signed-off-by: sk593 * update validate bicepconfig Signed-off-by: sk593 --------- Signed-off-by: sk593 --- .github/scripts/validate_bicep.py | 5 +++++ .github/workflows/validate-bicep.yaml | 10 +++++----- bicepconfig.json | 14 ++++++++++++++ samples/aws-sqs/sqs.bicep | 4 ++-- samples/aws/awss3.bicep | 4 ++-- samples/dapr/dapr-azure.bicep | 2 +- samples/dapr/dapr.bicep | 6 +++--- samples/demo/app.bicep | 2 +- samples/eshop-dapr/infra/dapr-pub-sub.bicep | 2 +- samples/eshop-dapr/infra/dapr-secret-store.bicep | 2 +- samples/eshop-dapr/infra/dapr-state-store.bicep | 2 +- samples/eshop-dapr/infra/gateway.bicep | 2 +- samples/eshop-dapr/infra/sql-server.bicep | 2 +- samples/eshop-dapr/main.bicep | 2 +- samples/eshop-dapr/services/basket-api.bicep | 2 +- samples/eshop-dapr/services/blazor-client.bicep | 2 +- samples/eshop-dapr/services/catalog-api.bicep | 2 +- samples/eshop-dapr/services/identity-api.bicep | 2 +- samples/eshop-dapr/services/ordering-api.bicep | 2 +- samples/eshop-dapr/services/payment-api.bicep | 2 +- samples/eshop-dapr/services/seq.bicep | 2 +- samples/eshop-dapr/services/webshopping-agg.bicep | 2 +- samples/eshop-dapr/services/webshopping-gw.bicep | 2 +- samples/eshop-dapr/services/webstatus.bicep | 2 +- samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/azure.bicep | 2 +- samples/eshop/eshop.bicep | 2 +- samples/eshop/infra/infra.bicep | 4 ++-- samples/eshop/infra/networking.bicep | 2 +- samples/eshop/services/basket.bicep | 4 ++-- samples/eshop/services/catalog.bicep | 4 ++-- samples/eshop/services/identity.bicep | 6 +++--- samples/eshop/services/ordering.bicep | 8 ++++---- samples/eshop/services/payment.bicep | 2 +- samples/eshop/services/seq.bicep | 2 +- samples/eshop/services/web.bicep | 6 +++--- samples/eshop/services/webhooks.bicep | 4 ++-- samples/eshop/services/webshopping.bicep | 2 +- samples/eshop/services/webstatus.bicep | 2 +- samples/volumes/app.bicep | 2 +- 40 files changed, 76 insertions(+), 57 deletions(-) create mode 100644 bicepconfig.json diff --git a/.github/scripts/validate_bicep.py b/.github/scripts/validate_bicep.py index fc57dfb4..75e369dd 100644 --- a/.github/scripts/validate_bicep.py +++ b/.github/scripts/validate_bicep.py @@ -45,6 +45,11 @@ def validate_file(f): ) stderr = result.stderr.decode("utf-8") exitcode = result.returncode + + warning_prefix = "WARNING: The following experimental Bicep features" + if stderr.startswith(warning_prefix) and "Error" not in stderr: + stderr = "" + exitcode = 0 if exitcode != 0: failures.append(f) diff --git a/.github/workflows/validate-bicep.yaml b/.github/workflows/validate-bicep.yaml index 69030e50..bc9d4d7b 100644 --- a/.github/workflows/validate-bicep.yaml +++ b/.github/workflows/validate-bicep.yaml @@ -29,12 +29,12 @@ jobs: name: Validate Bicep Code runs-on: ubuntu-latest steps: - - name: Check out repo - uses: actions/checkout@v4 - - name: Download rad-bicep + - name: Setup and verify bicep CLI run: | - oras pull ghcr.io/radius-project/radius/bicep/rad-bicep/linux-x64:latest - chmod +x rad-bicep + curl -Lo rad-bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 + chmod +x ./rad-bicep ./rad-bicep --version + - name: Check out repo + uses: actions/checkout@v4 - name: Verify Bicep files run: python ./.github/scripts/validate_bicep.py diff --git a/bicepconfig.json b/bicepconfig.json new file mode 100644 index 00000000..a034f8ce --- /dev/null +++ b/bicepconfig.json @@ -0,0 +1,14 @@ +{ + "experimentalFeaturesEnabled": { + "extensibility": true, + "extensionRegistry": true, + "dynamicTypeLoading": true + }, + "extensions": { + "radius": "br:biceptypes.azurecr.io/radius:latest", + "aws": "br:biceptypes.azurecr.io/aws:latest" + }, + "cloud": { + "credentialPrecedence": [ "Environment" ] + } +} \ No newline at end of file diff --git a/samples/aws-sqs/sqs.bicep b/samples/aws-sqs/sqs.bicep index 5bc7c125..c2b2f7df 100644 --- a/samples/aws-sqs/sqs.bicep +++ b/samples/aws-sqs/sqs.bicep @@ -1,5 +1,5 @@ -import aws as aws -import radius as radius +extension aws +extension radius param environment string param queue_name string diff --git a/samples/aws/awss3.bicep b/samples/aws/awss3.bicep index 9f01ac82..0fee8a82 100644 --- a/samples/aws/awss3.bicep +++ b/samples/aws/awss3.bicep @@ -1,5 +1,5 @@ -import aws as aws -import radius as radius +extension aws +extension radius param environment string diff --git a/samples/dapr/dapr-azure.bicep b/samples/dapr/dapr-azure.bicep index af2e96a8..aa61ac1b 100644 --- a/samples/dapr/dapr-azure.bicep +++ b/samples/dapr/dapr-azure.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius param location string = resourceGroup().location param environment string diff --git a/samples/dapr/dapr.bicep b/samples/dapr/dapr.bicep index 60004376..a24ee7fd 100644 --- a/samples/dapr/dapr.bicep +++ b/samples/dapr/dapr.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('Specifies the environment for resources.') param environment string @@ -83,10 +83,10 @@ resource stateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = { } } -import kubernetes as kubernetes{ +extension kubernetes with { kubeConfig: '' namespace: namespace -} +} as kubernetes resource statefulset 'apps/StatefulSet@v1' = { metadata: { diff --git a/samples/demo/app.bicep b/samples/demo/app.bicep index 8eabe9dd..4d31bd0b 100644 --- a/samples/demo/app.bicep +++ b/samples/demo/app.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius param application string param environment string diff --git a/samples/eshop-dapr/infra/dapr-pub-sub.bicep b/samples/eshop-dapr/infra/dapr-pub-sub.bicep index f2ffaeab..7a53f79c 100644 --- a/samples/eshop-dapr/infra/dapr-pub-sub.bicep +++ b/samples/eshop-dapr/infra/dapr-pub-sub.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/infra/dapr-secret-store.bicep b/samples/eshop-dapr/infra/dapr-secret-store.bicep index 0d1645d7..52881dcc 100644 --- a/samples/eshop-dapr/infra/dapr-secret-store.bicep +++ b/samples/eshop-dapr/infra/dapr-secret-store.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/infra/dapr-state-store.bicep b/samples/eshop-dapr/infra/dapr-state-store.bicep index 4d5fbb7a..acf70490 100644 --- a/samples/eshop-dapr/infra/dapr-state-store.bicep +++ b/samples/eshop-dapr/infra/dapr-state-store.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/infra/gateway.bicep b/samples/eshop-dapr/infra/gateway.bicep index 81d44ca3..f251f287 100644 --- a/samples/eshop-dapr/infra/gateway.bicep +++ b/samples/eshop-dapr/infra/gateway.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/infra/sql-server.bicep b/samples/eshop-dapr/infra/sql-server.bicep index 64fc428b..83f8bc77 100644 --- a/samples/eshop-dapr/infra/sql-server.bicep +++ b/samples/eshop-dapr/infra/sql-server.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/main.bicep b/samples/eshop-dapr/main.bicep index fcd1e5ef..e45a33a7 100644 --- a/samples/eshop-dapr/main.bicep +++ b/samples/eshop-dapr/main.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Azure region where the resources will be deployed.') param location string = resourceGroup().location diff --git a/samples/eshop-dapr/services/basket-api.bicep b/samples/eshop-dapr/services/basket-api.bicep index 6d496cdf..fa89370d 100644 --- a/samples/eshop-dapr/services/basket-api.bicep +++ b/samples/eshop-dapr/services/basket-api.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/blazor-client.bicep b/samples/eshop-dapr/services/blazor-client.bicep index 56c06211..b0a0e7e1 100644 --- a/samples/eshop-dapr/services/blazor-client.bicep +++ b/samples/eshop-dapr/services/blazor-client.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/catalog-api.bicep b/samples/eshop-dapr/services/catalog-api.bicep index 853f90bd..18e0f10c 100644 --- a/samples/eshop-dapr/services/catalog-api.bicep +++ b/samples/eshop-dapr/services/catalog-api.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/identity-api.bicep b/samples/eshop-dapr/services/identity-api.bicep index 4f861d98..0ecb2170 100644 --- a/samples/eshop-dapr/services/identity-api.bicep +++ b/samples/eshop-dapr/services/identity-api.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/ordering-api.bicep b/samples/eshop-dapr/services/ordering-api.bicep index c434cc9b..0be88e01 100644 --- a/samples/eshop-dapr/services/ordering-api.bicep +++ b/samples/eshop-dapr/services/ordering-api.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/payment-api.bicep b/samples/eshop-dapr/services/payment-api.bicep index 52786bf9..77b2a619 100644 --- a/samples/eshop-dapr/services/payment-api.bicep +++ b/samples/eshop-dapr/services/payment-api.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/seq.bicep b/samples/eshop-dapr/services/seq.bicep index 14d368f7..9877dd7b 100644 --- a/samples/eshop-dapr/services/seq.bicep +++ b/samples/eshop-dapr/services/seq.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/webshopping-agg.bicep b/samples/eshop-dapr/services/webshopping-agg.bicep index a4ffbe29..4efc7a4c 100644 --- a/samples/eshop-dapr/services/webshopping-agg.bicep +++ b/samples/eshop-dapr/services/webshopping-agg.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop-dapr/services/webshopping-gw.bicep b/samples/eshop-dapr/services/webshopping-gw.bicep index 4ab88564..2ce02039 100644 --- a/samples/eshop-dapr/services/webshopping-gw.bicep +++ b/samples/eshop-dapr/services/webshopping-gw.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius param appId string diff --git a/samples/eshop-dapr/services/webstatus.bicep b/samples/eshop-dapr/services/webstatus.bicep index 639a2933..5a697515 100644 --- a/samples/eshop-dapr/services/webstatus.bicep +++ b/samples/eshop-dapr/services/webstatus.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('The Radius application ID.') param appId string diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 61d5cc24..751c65ed 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius @description('Account ID of the AWS account resources should be deployed in') param awsAccountId string diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index a796cd24..9e178aea 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius @description('The name of the Azure resource group where Azure resources will be deployed.') param azureResourceGroup string diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep index ee77d102..312aa31f 100644 --- a/samples/eshop/eshop.bicep +++ b/samples/eshop/eshop.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // Parameters ------------------------------------------------------- diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep index f16d492e..a1b03617 100644 --- a/samples/eshop/infra/infra.bicep +++ b/samples/eshop/infra/infra.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius @description('Radius environment ID') param environment string @@ -113,4 +113,4 @@ output rabbitmq string = rabbitmq.name output servicebus string = servicebus.name @description('Event Bus connection string') -output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.secrets('connectionString') : rabbitmq.properties.host +output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.listSecrets().connectionString : rabbitmq.properties.host diff --git a/samples/eshop/infra/networking.bicep b/samples/eshop/infra/networking.bicep index 7a2f55c1..8e10cfb1 100644 --- a/samples/eshop/infra/networking.bicep +++ b/samples/eshop/infra/networking.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS ------------------------------------------------------------ @description('Radius application ID') diff --git a/samples/eshop/services/basket.bicep b/samples/eshop/services/basket.bicep index c3b9e327..1cb8bcd0 100644 --- a/samples/eshop/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // Parameters --------------------------------------------------------- @@ -46,7 +46,7 @@ resource basket 'Applications.Core/containers@2023-10-01-preview' = { PORT: '80' GRPC_PORT: '81' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: redisBasket.connectionString() + ConnectionString: redisBasket.listSecrets().connectionString EventBusConnection: eventBusConnectionString identityUrl: 'http://identity-api:5105' IdentityUrlExternal: '${gateway.properties.url}/identity-api' diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep index ec78da17..35199590 100644 --- a/samples/eshop/services/catalog.bicep +++ b/samples/eshop/services/catalog.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // Parameters --------------------------------------------------------- @@ -51,7 +51,7 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = { PicBaseUrl: PICBASEURL AzureStorageEnabled: 'False' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlCatalogDb.connectionString() + ConnectionString: sqlCatalogDb.listSecrets().connectionString EventBusConnection: eventBusConnectionString } ports: { diff --git a/samples/eshop/services/identity.bicep b/samples/eshop/services/identity.bicep index e95c4638..d146e283 100644 --- a/samples/eshop/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- @@ -35,9 +35,9 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = { ASPNETCORE_URLS: 'http://0.0.0.0:80' OrchestratorType: 'K8S' IsClusterEnv: 'True' - DPConnectionString: redisKeystore.connectionString() + DPConnectionString: redisKeystore.listSecrets().connectionString EnableDevspaces: 'False' - ConnectionString: sqlIdentityDb.connectionString() + ConnectionString: sqlIdentityDb.listSecrets().connectionString MvcClient: '${gateway.properties.url}/webmvc' SpaClient: gateway.properties.url BasketApiClient: '${gateway.properties.url}/basket-api' diff --git a/samples/eshop/services/ordering.bicep b/samples/eshop/services/ordering.bicep index edf366a3..1fa6bbd5 100644 --- a/samples/eshop/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- @@ -53,7 +53,7 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = { PATH_BASE: '/ordering-api' GRPC_PORT: '81' PORT: '80' - ConnectionString: sqlOrderingDb.connectionString() + ConnectionString: sqlOrderingDb.listSecrets().connectionString EventBusConnection: eventBusConnectionString identityUrl: 'http://identity-api:5105' IdentityUrlExternal: '${gateway.properties.url}/identity-api' @@ -99,7 +99,7 @@ resource orderbgtasks 'Applications.Core/containers@2023-10-01-preview' = { 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' ORCHESTRATOR_TYPE: 'K8S' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlOrderingDb.connectionString() + ConnectionString: sqlOrderingDb.listSecrets().connectionString EventBusConnection: eventBusConnectionString } ports: { @@ -133,7 +133,7 @@ resource orderingsignalrhub 'Applications.Core/containers@2023-10-01-preview' = IsClusterEnv: 'True' AzureServiceBusEnabled: AZURESERVICEBUSENABLED EventBusConnection: eventBusConnectionString - SignalrStoreConnectionString: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.password()},abortConnect=False' + SignalrStoreConnectionString: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.listSecrets().password},abortConnect=False' identityUrl: 'http://identity-api:5105' IdentityUrlExternal: '${gateway.properties.url}/identity-api' } diff --git a/samples/eshop/services/payment.bicep b/samples/eshop/services/payment.bicep index 32c6c38f..fddeb7dc 100644 --- a/samples/eshop/services/payment.bicep +++ b/samples/eshop/services/payment.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- diff --git a/samples/eshop/services/seq.bicep b/samples/eshop/services/seq.bicep index 32090891..cf97cb07 100644 --- a/samples/eshop/services/seq.bicep +++ b/samples/eshop/services/seq.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- diff --git a/samples/eshop/services/web.bicep b/samples/eshop/services/web.bicep index 4a2af4a6..276772aa 100644 --- a/samples/eshop/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- @@ -34,7 +34,7 @@ resource webspa 'Applications.Core/containers@2023-10-01-preview' = { ORCHESTRATOR_TYPE: 'K8S' IsClusterEnv: 'True' CallBackUrl: '${gateway.properties.url}/' - DPConnectionString: redisKeystore.connectionString() + DPConnectionString: redisKeystore.listSecrets().connectionString IdentityUrl: '${gateway.properties.url}/identity-api' IdentityUrlHC: 'http://identity-api:5105/liveness' PurchaseUrl: '${gateway.properties.url}/webshoppingapigw' @@ -94,7 +94,7 @@ resource webmvc 'Applications.Core/containers@2023-10-01-preview' = { ASPNETCORE_URLS: 'http://0.0.0.0:80' PATH_BASE: '/webmvc' UseCustomizationData: 'False' - DPConnectionString: redisKeystore.connectionString() + DPConnectionString: redisKeystore.listSecrets().connectionString UseLoadTest: 'False' ORCHESTRATOR_TYPE: 'K8S' IsClusterEnv: 'True' diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index 6a65df17..93b74de7 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- @@ -43,7 +43,7 @@ resource webhooks 'Applications.Core/containers@2023-10-01-preview' = { ASPNETCORE_URLS: 'http://0.0.0.0:80' ORCHESTRATOR_TYPE: 'K8S' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlWebhooksDb.connectionString() + ConnectionString: sqlWebhooksDb.listSecrets().connectionString EventBusConnection: eventBusConnectionString identityUrl: 'http://identity-api:5105' IdentityUrlExternal: '${gateway.properties.url}/identity-api' diff --git a/samples/eshop/services/webshopping.bicep b/samples/eshop/services/webshopping.bicep index a27f37bc..0de76854 100644 --- a/samples/eshop/services/webshopping.bicep +++ b/samples/eshop/services/webshopping.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- diff --git a/samples/eshop/services/webstatus.bicep b/samples/eshop/services/webstatus.bicep index b2f7fe10..c83bb61e 100644 --- a/samples/eshop/services/webstatus.bicep +++ b/samples/eshop/services/webstatus.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius // PARAMETERS --------------------------------------------------------- diff --git a/samples/volumes/app.bicep b/samples/volumes/app.bicep index 36504e27..d6700f79 100644 --- a/samples/volumes/app.bicep +++ b/samples/volumes/app.bicep @@ -1,4 +1,4 @@ -import radius as rad +extension radius param environment string From 3b6fa2075e96f60c3cf8785b06a0dd6c84eeee66 Mon Sep 17 00:00:00 2001 From: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:59:36 -0700 Subject: [PATCH 02/12] Update k3d create commands (#1683) * Upmerge fix (#1649) * Fix error when no branch changes Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Remove extra commit Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add comments Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Fix branch name env var Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Clarify comments Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add example Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --------- Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Update k3d create commands Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add comment describing the k3d configuration Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --------- Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --- .devcontainer/post-create.sh | 3 +- .github/workflows/test.yaml | 3 +- .github/workflows/upmerge.yaml | 55 ++++++++++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 26e3a7ee..8b83cb20 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -5,7 +5,8 @@ while (! kubectl cluster-info ); do # Docker takes a few seconds to initialize echo "Waiting for Docker to launch..." k3d cluster delete - k3d cluster create -p '8081:80@loadbalancer' --k3s-arg '--disable=traefik@server:0' + # Map localhost port 80 on the external load balancer, and disable traefik and the internal load balancer. + k3d cluster create -p '8081:80@loadbalancer' --k3s-arg '--disable=traefik@server:*' --k3s-arg '--disable=servicelb@server:*' sleep 1 done diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fb434133..904b1278 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -154,7 +154,8 @@ jobs: run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash - 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" --registry-create sampleregistry:51351 + # Map localhost port 80 on the external load balancer, and disable traefik and the internal load balancer. + run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:*" --k3s-arg "--disable=servicelb@server:*" --registry-create sampleregistry:51351 - name: Build images if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.images != '' run: | diff --git a/.github/workflows/upmerge.yaml b/.github/workflows/upmerge.yaml index 40004588..fd724a92 100644 --- a/.github/workflows/upmerge.yaml +++ b/.github/workflows/upmerge.yaml @@ -1,3 +1,27 @@ +# This workflow automates the process of upmerging changes from the current release branch to the edge branch. +# During the course of a release, the release branch is the default branch so that PRs can be immediately +# brought into the release without waiting for a new release. This workflow merges those changes into +# the edge branch so that edge can be used as the basis for the next release branch. +# +# This workflow assumes that it is being triggered from the current release branch, but it could be triggered from +# any branch, and it uses that branch as the source branch for merging into the edge branch. +# The workflow is triggered manually via the workflow_dispatch event. +# +# The workflow performs the following steps: +# 1. Checks out the edge branch. +# 2. Configures git with a user name and email. +# 3. Creates a new branch from edge. +# 4. Merges changes from the branch executing the workflow into the edge branch created in the previous step. +# 5. Pushes the new branch if there are changes. +# 6. Creates a pull request to merge the new branch into edge. + +# Example: +# The current release branch is v0.36. We are creating the new release for v0.37. +# The release person manually triggers this workflow from branch v0.36. The workflow runs, which does the following +# 1. A new branch is created named upmerge/2024-07-31-98b9. The source branch is edge. +# 2. Changes from branch v0.36 are merged into branch upmerge/2024-07-31-98b9. +# 3. A PR is created from branch upmerge/2024-07-31-98b9 --> edge. The workflow finishes and reports success. + name: Upmerge samples to edge on: @@ -8,30 +32,49 @@ jobs: name: Upmerge samples to edge runs-on: ubuntu-latest steps: + + # Check out the edge branch - uses: actions/checkout@v4 with: ref: edge # https://github.com/actions/checkout/issues/125#issuecomment-570254411 fetch-depth: 0 + - name: Configure git run: | git config --global user.email "radiuscoreteam@service.microsoft.com" git config --global user.name "Radius CI Bot" - - name: Create new branch + + # Create a new branch from edge. This branch will be used to PR back into edge. + - name: Create new branch from edge run: | export DATE=$(date +%Y-%m-%d) export RAND=$(openssl rand -hex 2) - echo "BRANCH_NAME=upmerge/$DATE-$RAND" >> $GITHUB_ENV - git checkout -b upmerge/$DATE-$RAND + export BRANCH_NAME=upmerge/$DATE-$RAND + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + git checkout -b $BRANCH_NAME + + # Merge changes from the github.ref branch, i.e., the branch from which the workflow is triggered. That + # branch is assumed to be the current release branch, but could be any branch. + # If there are no changes, stop the workflow. - name: Upmerge samples run: | export SOURCE_BRANCH=$(basename ${{ github.ref }}) echo "Upmerging samples from $SOURCE_BRANCH to edge" git fetch origin $SOURCE_BRANCH - git merge --no-commit origin/$SOURCE_BRANCH - git commit -m "Upmerge to edge" - git push --set-upstream origin $BRANCH_NAME + git merge -m "Upmerge to edge" origin/$SOURCE_BRANCH + + if git diff --quiet edge; then + echo "No changes to merge from $SOURCE_BRANCH to edge" + echo "NO_CHANGES=true" >> $GITHUB_ENV + else + echo "Pushing $BRANCH_NAME for PR to edge" + git push --set-upstream origin $BRANCH_NAME + fi + + # Create a PR from the new branch to edge - name: Create pull request + if: env.NO_CHANGES != 'true' env: GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT}} run: gh pr create --title "Upmerge to edge" --body "Upmerge to edge (kicked off by @${{ github.triggering_actor }})" --base edge --head $BRANCH_NAME From 81006a7acca1d812938a958f7706f308aae151b6 Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath <100623239+vishwahiremat@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:23:54 -0700 Subject: [PATCH 03/12] Adding `rad credential register aws` command changes in the workflow file (#1710) * Update k3d create commands (#1683) * Upmerge fix (#1649) * Fix error when no branch changes Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Remove extra commit Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add comments Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Fix branch name env var Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Clarify comments Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add example Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --------- Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Update k3d create commands Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> * Add comment describing the k3d configuration Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --------- Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Signed-off-by: Vishwanath Hiremath * adding aws credential command changes to workflow files Signed-off-by: Vishwanath Hiremath --------- Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Signed-off-by: Vishwanath Hiremath Co-authored-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --- .github/workflows/test.yaml | 2 +- samples/eshop/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 904b1278..750fd9ad 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -244,7 +244,7 @@ jobs: fi if [[ "${{ matrix.credential }}" == "aws" ]]; then rad env update default --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} - rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + rad credential register aws access-key --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi ## This step is temporary until we have Recipe Packs for Azure & AWS and update the eShop sample - name: Initialize eShop environments diff --git a/samples/eshop/README.md b/samples/eshop/README.md index efadf083..10a8c12a 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -16,7 +16,7 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. Set provider credentials to authenticate to your cloud provider (choose which type of hosting infrastructure you wish to use): ```bash # AWS - rad credential register aws --aws-access-key-id --aws-secret-access-key + rad credential register aws access-key --aws-access-key-id --aws-secret-access-key # Azure rad credential register azure sp --client-id --client-secret --tenant-id From c3b967be5e81f3360cd48347a062b03b6e3116d7 Mon Sep 17 00:00:00 2001 From: Shruthi Kumar Date: Fri, 6 Sep 2024 11:07:08 -0700 Subject: [PATCH 04/12] Update validate bicep workflow (#1736) * update validate bicep to print warnings Signed-off-by: sk593 * update biceps Signed-off-by: sk593 --------- Signed-off-by: sk593 --- .github/scripts/validate_bicep.py | 13 ++++++++----- .github/workflows/validate-bicep.yaml | 4 ++-- samples/eshop-dapr/infra/dapr-state-store.bicep | 2 +- samples/eshop/infra/infra.bicep | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/scripts/validate_bicep.py b/.github/scripts/validate_bicep.py index 75e369dd..39d5b3cd 100644 --- a/.github/scripts/validate_bicep.py +++ b/.github/scripts/validate_bicep.py @@ -28,6 +28,7 @@ files = [] failures = [] +warnings = [] # Walk the directory tree and find all .bicep files for root, _, filenames in os.walk("."): @@ -46,12 +47,11 @@ def validate_file(f): stderr = result.stderr.decode("utf-8") exitcode = result.returncode - warning_prefix = "WARNING: The following experimental Bicep features" - if stderr.startswith(warning_prefix) and "Error" not in stderr: - stderr = "" - exitcode = 0 + if "Warning" in stderr: + warnings.append(f) + print(stderr, flush=True) - if exitcode != 0: + if exitcode != 0 or "Error" in stderr: failures.append(f) print(stderr, flush=True) @@ -62,4 +62,7 @@ def validate_file(f): for f in failures: print(f"Failed: {f}", flush=True) +for f in warnings: + print(f"Warning: {f}", flush=True) + exit(len(failures)) diff --git a/.github/workflows/validate-bicep.yaml b/.github/workflows/validate-bicep.yaml index bc9d4d7b..6493bb0a 100644 --- a/.github/workflows/validate-bicep.yaml +++ b/.github/workflows/validate-bicep.yaml @@ -29,12 +29,12 @@ jobs: name: Validate Bicep Code runs-on: ubuntu-latest steps: + - name: Check out repo + uses: actions/checkout@v4 - name: Setup and verify bicep CLI run: | curl -Lo rad-bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 chmod +x ./rad-bicep ./rad-bicep --version - - name: Check out repo - uses: actions/checkout@v4 - name: Verify Bicep files run: python ./.github/scripts/validate_bicep.py diff --git a/samples/eshop-dapr/infra/dapr-state-store.bicep b/samples/eshop-dapr/infra/dapr-state-store.bicep index acf70490..e12b82b9 100644 --- a/samples/eshop-dapr/infra/dapr-state-store.bicep +++ b/samples/eshop-dapr/infra/dapr-state-store.bicep @@ -91,7 +91,7 @@ resource daprStateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = { version: 'v1' metadata: { url: cosmosAccount.properties.documentEndpoint - masterKey: listKeys(cosmosAccount.id, cosmosAccount.apiVersion).primaryMasterKey + masterKey: cosmosAccount.listKeys().primaryMasterKey database: cosmosDbName collection: cosmosDbCollectionName actorStateStore: 'true' diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep index a1b03617..f804b935 100644 --- a/samples/eshop/infra/infra.bicep +++ b/samples/eshop/infra/infra.bicep @@ -113,4 +113,5 @@ output rabbitmq string = rabbitmq.name output servicebus string = servicebus.name @description('Event Bus connection string') +#disable-next-line outputs-should-not-contain-secrets output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.listSecrets().connectionString : rabbitmq.properties.host From ac2909af5680dcc07b9499b067ed74777c50ce0e Mon Sep 17 00:00:00 2001 From: Nick Beenham <1985327+superbeeny@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:49:35 -0400 Subject: [PATCH 05/12] updating samples for new environment variables schema (#1742) Signed-off-by: Nick Beenham <1985327+superbeeny@users.noreply.github.com> Co-authored-by: Karishma Chawla --- README.md | 2 +- samples/aws-sqs/sqs.bicep | 16 +- samples/aws/awss3.bicep | 16 +- samples/dapr/dapr-azure.bicep | 8 +- samples/dapr/dapr.bicep | 8 +- samples/eshop-dapr/services/basket-api.bicep | 20 ++- .../eshop-dapr/services/blazor-client.bicep | 20 ++- samples/eshop-dapr/services/catalog-api.bicep | 16 +- .../eshop-dapr/services/identity-api.bicep | 28 +++- .../eshop-dapr/services/ordering-api.bicep | 28 +++- samples/eshop-dapr/services/payment-api.bicep | 12 +- samples/eshop-dapr/services/seq.bicep | 4 +- .../eshop-dapr/services/webshopping-agg.bicep | 32 +++- .../eshop-dapr/services/webshopping-gw.bicep | 16 +- samples/eshop-dapr/services/webstatus.bicep | 68 ++++++-- samples/eshop/services/basket.bicep | 48 ++++-- samples/eshop/services/catalog.bicep | 44 ++++-- samples/eshop/services/identity.bicep | 60 +++++-- samples/eshop/services/ordering.bicep | 148 +++++++++++++----- samples/eshop/services/payment.bicep | 20 ++- samples/eshop/services/seq.bicep | 4 +- samples/eshop/services/web.bicep | 48 ++++-- samples/eshop/services/webhooks.bicep | 36 +++-- samples/eshop/services/webshopping.bicep | 72 ++++++--- samples/eshop/services/webstatus.bicep | 92 ++++++++--- 25 files changed, 649 insertions(+), 217 deletions(-) diff --git a/README.md b/README.md index 4f29d254..fe3ef652 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This repository contains the source code for quickstarts, reference apps, and tutorials for Radius. -To try out one of these samples, visit https://docs.radapp.dev +To try out one of these samples, visit https://docs.radapp.io ## Codespace diff --git a/samples/aws-sqs/sqs.bicep b/samples/aws-sqs/sqs.bicep index c2b2f7df..e5ae0468 100644 --- a/samples/aws-sqs/sqs.bicep +++ b/samples/aws-sqs/sqs.bicep @@ -41,8 +41,12 @@ resource producer 'Applications.Core/containers@2023-10-01-preview' = { container: { env: union( { - SQS_QUEUE_URL: queue.properties.QueueUrl - HTTP_SERVER_PORT: '3000' + SQS_QUEUE_URL: { + value: queue.properties.QueueUrl + } + HTTP_SERVER_PORT: { + value: '3000' + } }, aws_credential ) @@ -58,8 +62,12 @@ resource consumer 'Applications.Core/containers@2023-10-01-preview' = { container: { env: union( { - SQS_QUEUE_URL: queue.properties.QueueUrl - HTTP_SERVER_PORT: '4000' + SQS_QUEUE_URL: { + value: queue.properties.QueueUrl + } + HTTP_SERVER_PORT: { + value: '4000' + } }, aws_credential ) diff --git a/samples/aws/awss3.bicep b/samples/aws/awss3.bicep index 0fee8a82..82ed6917 100644 --- a/samples/aws/awss3.bicep +++ b/samples/aws/awss3.bicep @@ -36,10 +36,18 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = { application: app.id container: { env: { - BUCKET_NAME: s3.properties.BucketName - AWS_ACCESS_KEY_ID: aws_access_key_id - AWS_SECRET_ACCESS_KEY: aws_secret_access_key - AWS_DEFAULT_REGION: aws_region + BUCKET_NAME: { + value: s3.properties.BucketName + } + AWS_ACCESS_KEY_ID: { + value: aws_access_key_id + } + AWS_SECRET_ACCESS_KEY: { + value: aws_secret_access_key + } + AWS_DEFAULT_REGION: { + value: aws_region + } } image: image } diff --git a/samples/dapr/dapr-azure.bicep b/samples/dapr/dapr-azure.bicep index aa61ac1b..88908e04 100644 --- a/samples/dapr/dapr-azure.bicep +++ b/samples/dapr/dapr-azure.bicep @@ -44,8 +44,12 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/dapr-frontend:latest' env: { - CONNECTION_BACKEND_APPID: backend.name - ASPNETCORE_URLS: 'http://*:8080' + CONNECTION_BACKEND_APPID: { + value: backend.name + } + ASPNETCORE_URLS: { + value: 'http://*:8080' + } } ports: { ui: { diff --git a/samples/dapr/dapr.bicep b/samples/dapr/dapr.bicep index a24ee7fd..d0c79c39 100644 --- a/samples/dapr/dapr.bicep +++ b/samples/dapr/dapr.bicep @@ -50,8 +50,12 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = { container: { image: frontendImage env: { - CONNECTION_BACKEND_APPID: backend.name - ASPNETCORE_URLS: 'http://*:8080' + CONNECTION_BACKEND_APPID: { + value: backend.name + } + ASPNETCORE_URLS: { + value: 'http://*:8080' + } } ports: { ui: { diff --git a/samples/eshop-dapr/services/basket-api.bicep b/samples/eshop-dapr/services/basket-api.bicep index fa89370d..c3c3e1e2 100644 --- a/samples/eshop-dapr/services/basket-api.bicep +++ b/samples/eshop-dapr/services/basket-api.bicep @@ -42,11 +42,21 @@ resource basketApi 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/basket.api:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - IdentityUrl: 'http://identity-api:80' - IdentityUrlExternal: '${gateway.properties.url}/identity/' - SeqServerUrl: 'http://seq:5340' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + IdentityUrl: { + value: 'http://identity-api:80' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity/' + } + SeqServerUrl: { + value: 'http://seq:5340' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/blazor-client.bicep b/samples/eshop-dapr/services/blazor-client.bicep index b0a0e7e1..42c13b1a 100644 --- a/samples/eshop-dapr/services/blazor-client.bicep +++ b/samples/eshop-dapr/services/blazor-client.bicep @@ -26,11 +26,21 @@ resource blazorClient 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/blazor.client:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - ApiGatewayUrlExternal: '${gateway.properties.url}/api/' - IdentityUrlExternal: '${gateway.properties.url}/identity/' - SeqServerUrl: 'http://seq:5340' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + ApiGatewayUrlExternal: { + value: '${gateway.properties.url}/api/' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity/' + } + SeqServerUrl: { + value: 'http://seq:5340' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/catalog-api.bicep b/samples/eshop-dapr/services/catalog-api.bicep index 18e0f10c..d46c3307 100644 --- a/samples/eshop-dapr/services/catalog-api.bicep +++ b/samples/eshop-dapr/services/catalog-api.bicep @@ -51,10 +51,18 @@ resource catalogApi 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/catalog.api:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - RetryMigrations: 'true' - SeqServerUrl: 'http://seq:5340' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + RetryMigrations: { + value: 'true' + } + SeqServerUrl: { + value: 'http://seq:5340' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/identity-api.bicep b/samples/eshop-dapr/services/identity-api.bicep index 0ecb2170..36fb846e 100644 --- a/samples/eshop-dapr/services/identity-api.bicep +++ b/samples/eshop-dapr/services/identity-api.bicep @@ -49,13 +49,27 @@ resource identityApi 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/identity.api:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/identity/' - BlazorClientUrlExternal: gateway.properties.url - IssuerUrl: '${gateway.properties.url}/identity/' - RetryMigrations: 'true' - SeqServerUrl: 'http://seq:5340' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + PATH_BASE: { + value: '/identity/' + } + BlazorClientUrlExternal: { + value: gateway.properties.url + } + IssuerUrl: { + value: '${gateway.properties.url}/identity/' + } + RetryMigrations: { + value: 'true' + } + SeqServerUrl: { + value: 'http://seq:5340' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/ordering-api.bicep b/samples/eshop-dapr/services/ordering-api.bicep index 0be88e01..87f9a7ba 100644 --- a/samples/eshop-dapr/services/ordering-api.bicep +++ b/samples/eshop-dapr/services/ordering-api.bicep @@ -57,13 +57,27 @@ resource orderingApi 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/ordering.api:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - IdentityUrl: 'http://identity-api:80' - IdentityUrlExternal: '${gateway.properties.url}/identity/' - RetryMigrations: 'true' - SeqServerUrl: 'http://seq:5340' - SendConfirmationEmail: 'false' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + IdentityUrl: { + value: 'http://identity-api:80' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity/' + } + RetryMigrations: { + value: 'true' + } + SeqServerUrl: { + value: 'http://seq:5340' + } + SendConfirmationEmail: { + value: 'false' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/payment-api.bicep b/samples/eshop-dapr/services/payment-api.bicep index 77b2a619..566e297f 100644 --- a/samples/eshop-dapr/services/payment-api.bicep +++ b/samples/eshop-dapr/services/payment-api.bicep @@ -28,9 +28,15 @@ resource paymentApi 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/payment.api:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - SeqServerUrl: 'http://seq:5340' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + SeqServerUrl: { + value: 'http://seq:5340' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/seq.bicep b/samples/eshop-dapr/services/seq.bicep index 9877dd7b..2b7fb4d7 100644 --- a/samples/eshop-dapr/services/seq.bicep +++ b/samples/eshop-dapr/services/seq.bicep @@ -14,7 +14,9 @@ resource seq 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'datalust/seq:latest' env: { - ACCEPT_EULA: 'Y' + ACCEPT_EULA: { + value: 'Y' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/webshopping-agg.bicep b/samples/eshop-dapr/services/webshopping-agg.bicep index 4efc7a4c..87653be5 100644 --- a/samples/eshop-dapr/services/webshopping-agg.bicep +++ b/samples/eshop-dapr/services/webshopping-agg.bicep @@ -28,14 +28,30 @@ resource webshoppingAgg 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/webshoppingagg:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - IdentityUrl: 'http://identity-api:80' - IdentityUrlExternal: '${gateway.properties.url}/identity/' - SeqServerUrl: 'http://seq:5340' - BasketUrlHC: 'http://localhost:3500/v1.0/invoke/basket-api/method/liveness' - CatalogUrlHC: 'http://localhost:3500/v1.0/invoke/catalog-api/method/liveness' - IdentityUrlHC: 'http://localhost:3500/v1.0/invoke/identity-api/method/liveness' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + IdentityUrl: { + value: 'http://identity-api:80' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity/' + } + SeqServerUrl: { + value: 'http://seq:5340' + } + BasketUrlHC: { + value: 'http://localhost:3500/v1.0/invoke/basket-api/method/liveness' + } + CatalogUrlHC: { + value: 'http://localhost:3500/v1.0/invoke/catalog-api/method/liveness' + } + IdentityUrlHC: { + value: 'http://localhost:3500/v1.0/invoke/identity-api/method/liveness' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/webshopping-gw.bicep b/samples/eshop-dapr/services/webshopping-gw.bicep index 2ce02039..94f57280 100644 --- a/samples/eshop-dapr/services/webshopping-gw.bicep +++ b/samples/eshop-dapr/services/webshopping-gw.bicep @@ -11,10 +11,18 @@ resource webshoppingGw 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/webshoppingapigw:rad-latest' env: { - ENVOY_CATALOG_API_ADDRESS: 'catalog-api' - ENVOY_CATALOG_API_PORT: '80' - ENVOY_ORDERING_API_ADDRESS: 'ordering-api' - ENVOY_ORDERING_API_PORT: '80' + ENVOY_CATALOG_API_ADDRESS: { + value: 'catalog-api' + } + ENVOY_CATALOG_API_PORT: { + value: '80' + } + ENVOY_ORDERING_API_ADDRESS: { + value: 'ordering-api' + } + ENVOY_ORDERING_API_PORT: { + value: '80' + } } ports: { http: { diff --git a/samples/eshop-dapr/services/webstatus.bicep b/samples/eshop-dapr/services/webstatus.bicep index 5a697515..eaf48958 100644 --- a/samples/eshop-dapr/services/webstatus.bicep +++ b/samples/eshop-dapr/services/webstatus.bicep @@ -17,23 +17,57 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'ghcr.io/radius-project/samples/eshopdapr/webstatus:rad-latest' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/health' - HealthChecksUI__HealthChecks__0__Name: 'Blazor UI Host' - HealthChecksUI__HealthChecks__0__Uri: 'http://blazor-client:80/liveness' - HealthChecksUI__HealthChecks__1__Name: 'Identity API' - HealthChecksUI__HealthChecks__1__Uri: 'http://localhost:3500/v1.0/invoke/identity-api/method/liveness' - HealthChecksUI__HealthChecks__2__Name: 'Basket API' - HealthChecksUI__HealthChecks__2__Uri: 'http://localhost:3500/v1.0/invoke/basket-api/method/liveness' - HealthChecksUI__HealthChecks__3__Name: 'Catalog API' - HealthChecksUI__HealthChecks__3__Uri: 'http://localhost:3500/v1.0/invoke/catalog-api/method/liveness' - HealthChecksUI__HealthChecks__4__Name: 'Ordering API' - HealthChecksUI__HealthChecks__4__Uri: 'http://localhost:3500/v1.0/invoke/ordering-api/method/liveness' - HealthChecksUI__HealthChecks__5__Name: 'Payment API' - HealthChecksUI__HealthChecks__5__Uri: 'http://localhost:3500/v1.0/invoke/payment-api/method/liveness' - HealthChecksUI__HealthChecks__6__Name: 'Web Shopping Aggregator' - HealthChecksUI__HealthChecks__6__Uri: 'http://localhost:3500/v1.0/invoke/webshoppingagg/method/liveness' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + PATH_BASE: { + value: '/health' + } + HealthChecksUI__HealthChecks__0__Name: { + value: 'Blazor UI Host' + } + HealthChecksUI__HealthChecks__0__Uri: { + value: 'http://blazor-client:80/liveness' + } + HealthChecksUI__HealthChecks__1__Name: { + value: 'Identity API' + } + HealthChecksUI__HealthChecks__1__Uri: { + value: 'http://localhost:3500/v1.0/invoke/identity-api/method/liveness' + } + HealthChecksUI__HealthChecks__2__Name: { + value: 'Basket API' + } + HealthChecksUI__HealthChecks__2__Uri: { + value: 'http://localhost:3500/v1.0/invoke/basket-api/method/liveness' + } + HealthChecksUI__HealthChecks__3__Name: { + value: 'Catalog API' + } + HealthChecksUI__HealthChecks__3__Uri: { + value: 'http://localhost:3500/v1.0/invoke/catalog-api/method/liveness' + } + HealthChecksUI__HealthChecks__4__Name: { + value: 'Ordering API' + } + HealthChecksUI__HealthChecks__4__Uri: { + value: 'http://localhost:3500/v1.0/invoke/ordering-api/method/liveness' + } + HealthChecksUI__HealthChecks__5__Name: { + value: 'Payment API' + } + HealthChecksUI__HealthChecks__5__Uri: { + value: 'http://localhost:3500/v1.0/invoke/payment-api/method/liveness' + } + HealthChecksUI__HealthChecks__6__Name: { + value: 'Web Shopping Aggregator' + } + HealthChecksUI__HealthChecks__6__Uri: { + value: 'http://localhost:3500/v1.0/invoke/webshoppingagg/method/liveness' + } } ports: { http: { diff --git a/samples/eshop/services/basket.bicep b/samples/eshop/services/basket.bicep index 1cb8bcd0..a9342764 100644 --- a/samples/eshop/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -38,18 +38,42 @@ resource basket 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/basket.api:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseLoadTest: 'False' - PATH_BASE: '/basket-api' - ORCHESTRATOR_TYPE: 'K8S' - PORT: '80' - GRPC_PORT: '81' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: redisBasket.listSecrets().connectionString - EventBusConnection: eventBusConnectionString - identityUrl: 'http://identity-api:5105' - IdentityUrlExternal: '${gateway.properties.url}/identity-api' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + UseLoadTest: { + value: 'False' + } + PATH_BASE: { + value: '/basket-api' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + PORT: { + value: '80' + } + GRPC_PORT: { + value: '81' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + ConnectionString: { + value: redisBasket.listSecrets().connectionString + } + EventBusConnection: { + value: eventBusConnectionString + } + identityUrl: { + value: 'http://identity-api:5105' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep index 35199590..fb615b9c 100644 --- a/samples/eshop/services/catalog.bicep +++ b/samples/eshop/services/catalog.bicep @@ -42,17 +42,39 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/catalog.api:${imageTag}' env: { - UseCustomizationData: 'False' - PATH_BASE: '/catalog-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ORCHESTRATOR_TYPE: 'K8S' - PORT: '80' - GRPC_PORT: '81' - PicBaseUrl: PICBASEURL - AzureStorageEnabled: 'False' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlCatalogDb.listSecrets().connectionString - EventBusConnection: eventBusConnectionString + UseCustomizationData: { + value: 'False' + } + PATH_BASE: { + value: '/catalog-api' + } + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + PORT: { + value: '80' + } + GRPC_PORT: { + value: '81' + } + PicBaseUrl: { + value: PICBASEURL + } + AzureStorageEnabled: { + value: 'False' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + ConnectionString: { + value: sqlCatalogDb.listSecrets().connectionString + } + EventBusConnection: { + value: eventBusConnectionString + } } ports: { http: { diff --git a/samples/eshop/services/identity.bicep b/samples/eshop/services/identity.bicep index d146e283..ef7fb7a9 100644 --- a/samples/eshop/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -30,21 +30,51 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/identity.api:${imageTag}' env: { - PATH_BASE: '/identity-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: 'K8S' - IsClusterEnv: 'True' - DPConnectionString: redisKeystore.listSecrets().connectionString - EnableDevspaces: 'False' - ConnectionString: sqlIdentityDb.listSecrets().connectionString - MvcClient: '${gateway.properties.url}/webmvc' - SpaClient: gateway.properties.url - BasketApiClient: '${gateway.properties.url}/basket-api' - OrderingApiClient: '${gateway.properties.url}/ordering-api' - WebShoppingAggClient: '${gateway.properties.url}/webshoppingagg' - WebhooksApiClient: '${gateway.properties.url}/webhooks-api' - WebhooksWebClient: '${gateway.properties.url}/webhooks-client' + PATH_BASE: { + value: '/identity-api' + } + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + OrchestratorType: { + value: 'K8S' + } + IsClusterEnv: { + value: 'True' + } + DPConnectionString: { + value: redisKeystore.listSecrets().connectionString + } + EnableDevspaces: { + value: 'False' + } + ConnectionString: { + value: sqlIdentityDb.listSecrets().connectionString + } + MvcClient: { + value: '${gateway.properties.url}/webmvc' + } + SpaClient: { + value: gateway.properties.url + } + BasketApiClient: { + value: '${gateway.properties.url}/basket-api' + } + OrderingApiClient: { + value: '${gateway.properties.url}/ordering-api' + } + WebShoppingAggClient: { + value: '${gateway.properties.url}/webshoppingagg' + } + WebhooksApiClient: { + value: '${gateway.properties.url}/webhooks-api' + } + WebhooksWebClient: { + value: '${gateway.properties.url}/webhooks-client' + } } ports: { http: { diff --git a/samples/eshop/services/ordering.bicep b/samples/eshop/services/ordering.bicep index 1fa6bbd5..ae35139b 100644 --- a/samples/eshop/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -41,22 +41,54 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/ordering.api:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - CheckUpdateTime: '30000' - ORCHESTRATOR_TYPE: 'K8S' - UseLoadTest: 'False' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - 'Serilog__MinimumLevel__Override__ordering-api': 'Verbose' - PATH_BASE: '/ordering-api' - GRPC_PORT: '81' - PORT: '80' - ConnectionString: sqlOrderingDb.listSecrets().connectionString - EventBusConnection: eventBusConnectionString - identityUrl: 'http://identity-api:5105' - IdentityUrlExternal: '${gateway.properties.url}/identity-api' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + UseCustomizationData: { + value: 'False' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + CheckUpdateTime: { + value: '30000' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + UseLoadTest: { + value: 'False' + } + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': { + value: 'Verbose' + } + 'Serilog__MinimumLevel__Override__ordering-api': { + value: 'Verbose' + } + PATH_BASE: { + value: '/ordering-api' + } + GRPC_PORT: { + value: '81' + } + PORT: { + value: '80' + } + ConnectionString: { + value: sqlOrderingDb.listSecrets().connectionString + } + EventBusConnection: { + value: eventBusConnectionString + } + identityUrl: { + value: 'http://identity-api:5105' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { @@ -90,17 +122,39 @@ resource orderbgtasks 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/ordering.backgroundtasks:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - CheckUpdateTime: '30000' - GracePeriodTime: '1' - UseLoadTest: 'False' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - ORCHESTRATOR_TYPE: 'K8S' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlOrderingDb.listSecrets().connectionString - EventBusConnection: eventBusConnectionString + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + UseCustomizationData: { + value: 'False' + } + CheckUpdateTime: { + value: '30000' + } + GracePeriodTime: { + value: '1' + } + UseLoadTest: { + value: 'False' + } + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': { + value: 'Verbose' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + ConnectionString: { + value: sqlOrderingDb.listSecrets().connectionString + } + EventBusConnection: { + value: eventBusConnectionString + } } ports: { http: { @@ -126,16 +180,36 @@ resource orderingsignalrhub 'Applications.Core/containers@2023-10-01-preview' = container: { image: '${imageRegistry}/ordering.signalrhub:${imageTag}' env: { - PATH_BASE: '/payment-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: 'K8S' - IsClusterEnv: 'True' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: eventBusConnectionString - SignalrStoreConnectionString: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.listSecrets().password},abortConnect=False' - identityUrl: 'http://identity-api:5105' - IdentityUrlExternal: '${gateway.properties.url}/identity-api' + PATH_BASE: { + value: '/payment-api' + } + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + OrchestratorType: { + value: 'K8S' + } + IsClusterEnv: { + value: 'True' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + EventBusConnection: { + value: eventBusConnectionString + } + SignalrStoreConnectionString: { + value: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.listSecrets().password},abortConnect=False' + } + identityUrl: { + value: 'http://identity-api:5105' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { diff --git a/samples/eshop/services/payment.bicep b/samples/eshop/services/payment.bicep index fddeb7dc..18cdc809 100644 --- a/samples/eshop/services/payment.bicep +++ b/samples/eshop/services/payment.bicep @@ -32,11 +32,21 @@ resource payment 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/payment.api:${imageTag}' env: { - 'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': 'Verbose' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - ORCHESTRATOR_TYPE: 'K8S' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: eventBusConnectionString + 'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': { + value: 'Verbose' + } + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': { + value: 'Verbose' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + EventBusConnection: { + value: eventBusConnectionString + } } ports: { http: { diff --git a/samples/eshop/services/seq.bicep b/samples/eshop/services/seq.bicep index cf97cb07..f6a5d1e4 100644 --- a/samples/eshop/services/seq.bicep +++ b/samples/eshop/services/seq.bicep @@ -14,7 +14,9 @@ resource seq 'Applications.Core/containers@2023-10-01-preview' = { container: { image: 'datalust/seq:latest' env: { - ACCEPT_EULA: 'Y' + ACCEPT_EULA: { + value: 'Y' + } } ports: { web: { diff --git a/samples/eshop/services/web.bicep b/samples/eshop/services/web.bicep index 276772aa..e7448796 100644 --- a/samples/eshop/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -27,18 +27,42 @@ resource webspa 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webspa:${imageTag}' env: { - PATH_BASE: '/' - ASPNETCORE_ENVIRONMENT: 'Production' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - ORCHESTRATOR_TYPE: 'K8S' - IsClusterEnv: 'True' - CallBackUrl: '${gateway.properties.url}/' - DPConnectionString: redisKeystore.listSecrets().connectionString - IdentityUrl: '${gateway.properties.url}/identity-api' - IdentityUrlHC: 'http://identity-api:5105/liveness' - PurchaseUrl: '${gateway.properties.url}/webshoppingapigw' - SignalrHubUrl: 'http://ordering-signalrhub:5112' + PATH_BASE: { + value: '/' + } + ASPNETCORE_ENVIRONMENT: { + value: 'Production' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + UseCustomizationData: { + value: 'False' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + IsClusterEnv: { + value: 'True' + } + CallBackUrl: { + value: '${gateway.properties.url}/' + } + DPConnectionString: { + value: redisKeystore.listSecrets().connectionString + } + IdentityUrl: { + value: '${gateway.properties.url}/identity-api' + } + IdentityUrlHC: { + value: 'http://identity-api:5105/liveness' + } + PurchaseUrl: { + value: '${gateway.properties.url}/webshoppingapigw' + } + SignalrHubUrl: { + value: 'http://ordering-signalrhub:5112' + } } ports: { http: { diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index 93b74de7..fab5fe99 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -38,15 +38,33 @@ resource webhooks 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webhooks.api:${imageTag}' env: { - PATH_BASE: '/webhooks-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - ORCHESTRATOR_TYPE: 'K8S' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlWebhooksDb.listSecrets().connectionString - EventBusConnection: eventBusConnectionString - identityUrl: 'http://identity-api:5105' - IdentityUrlExternal: '${gateway.properties.url}/identity-api' + PATH_BASE: { + value: '/webhooks-api' + } + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + AzureServiceBusEnabled: { + value: AZURESERVICEBUSENABLED + } + ConnectionString: { + value: sqlWebhooksDb.listSecrets().connectionString + } + EventBusConnection: { + value: eventBusConnectionString + } + identityUrl: { + value: 'http://identity-api:5105' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { diff --git a/samples/eshop/services/webshopping.bicep b/samples/eshop/services/webshopping.bicep index 0de76854..9bd946b9 100644 --- a/samples/eshop/services/webshopping.bicep +++ b/samples/eshop/services/webshopping.bicep @@ -22,24 +22,60 @@ resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webshoppingagg:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - PATH_BASE: '/webshoppingagg' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - ORCHESTRATOR_TYPE: 'K8S' - IsClusterEnv: 'True' - urls__basket: 'http://basket-api:5103' - urls__catalog: 'http://catalog-api:5101' - urls__orders: 'http://ordering-api:5102' - urls__identity: 'http://identity-api:5105' - urls__grpcBasket: 'grpc://basket-api:9103' - urls__grpcCatalog: 'grpc://catalog-api:9101' - urls__grpcOrdering: 'grpc://ordering-api:9102' - CatalogUrlHC: 'http://catalog-api:5101/liveness' - OrderingUrlHC: 'http://ordering-api:5102/liveness' - IdentityUrlHC: 'http://identity-api:5105/liveness' - BasketUrlHC: 'http://basket-api:5103/liveness' - PaymentUrlHC: 'http://payment-api:5108/liveness' - IdentityUrlExternal: '${gateway.properties.url}/identity-api' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + PATH_BASE: { + value: '/webshoppingagg' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + IsClusterEnv: { + value: 'True' + } + urls__basket: { + value: 'http://basket-api:5103' + } + urls__catalog: { + value: 'http://catalog-api:5101' + } + urls__orders: { + value: 'http://ordering-api:5102' + } + urls__identity: { + value: 'http://identity-api:5105' + } + urls__grpcBasket: { + value: 'grpc://basket-api:9103' + } + urls__grpcCatalog: { + value: 'grpc://catalog-api:9101' + } + urls__grpcOrdering: { + value: 'grpc://ordering-api:9102' + } + CatalogUrlHC: { + value: 'http://catalog-api:5101/liveness' + } + OrderingUrlHC: { + value: 'http://ordering-api:5102/liveness' + } + IdentityUrlHC: { + value: 'http://identity-api:5105/liveness' + } + BasketUrlHC: { + value: 'http://basket-api:5103/liveness' + } + PaymentUrlHC: { + value: 'http://payment-api:5108/liveness' + } + IdentityUrlExternal: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { diff --git a/samples/eshop/services/webstatus.bicep b/samples/eshop/services/webstatus.bicep index c83bb61e..ad01a8d8 100644 --- a/samples/eshop/services/webstatus.bicep +++ b/samples/eshop/services/webstatus.bicep @@ -21,29 +21,75 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webstatus:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - HealthChecksUI__HealthChecks__0__Name: 'WebMVC HTTP Check' - HealthChecksUI__HealthChecks__0__Uri: 'http://webmvc:5100/liveness' - HealthChecksUI__HealthChecks__1__Name: 'WebSPA HTTP Check' - HealthChecksUI__HealthChecks__1__Uri: 'http://web-spa:5104/liveness' - HealthChecksUI__HealthChecks__2__Name: 'Web Shopping Aggregator GW HTTP Check' - HealthChecksUI__HealthChecks__2__Uri: 'http://webshoppingagg:5121/liveness' - HealthChecksUI__HealthChecks__4__Name: 'Ordering HTTP Check' - HealthChecksUI__HealthChecks__4__Uri: 'http://ordering-api:5102/liveness' - HealthChecksUI__HealthChecks__5__Name: 'Basket HTTP Check' - HealthChecksUI__HealthChecks__5__Uri: 'http://basket-api:5103/liveness' - HealthChecksUI__HealthChecks__6__Name: 'Catalog HTTP Check' - HealthChecksUI__HealthChecks__6__Uri: 'http://catalog-api/liveness' - HealthChecksUI__HealthChecks__7__Name: 'Identity HTTP Check' - HealthChecksUI__HealthChecks__7__Uri: 'http://identity-api:5105/liveness' - HealthChecksUI__HealthChecks__8__Name: 'Payments HTTP Check' - HealthChecksUI__HealthChecks__8__Uri: 'http://payment-api:5108/liveness' - HealthChecksUI__HealthChecks__9__Name: 'Ordering SignalRHub HTTP Check' - HealthChecksUI__HealthChecks__9__Uri: 'http://ordering-signalrhub:5112/liveness' - HealthChecksUI__HealthChecks__10__Name: 'Ordering HTTP Background Check' - HealthChecksUI__HealthChecks__10__Uri: 'http://ordering-backgroundtasks:5111/liveness' - ORCHESTRATOR_TYPE: 'K8S' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + HealthChecksUI__HealthChecks__0__Name: { + value: 'WebMVC HTTP Check' + } + HealthChecksUI__HealthChecks__0__Uri: { + value: 'http://webmvc:5100/liveness' + } + HealthChecksUI__HealthChecks__1__Name: { + value: 'WebSPA HTTP Check' + } + HealthChecksUI__HealthChecks__1__Uri: { + value: 'http://web-spa:5104/liveness' + } + HealthChecksUI__HealthChecks__2__Name: { + value: 'Web Shopping Aggregator GW HTTP Check' + } + HealthChecksUI__HealthChecks__2__Uri: { + value: 'http://webshoppingagg:5121/liveness' + } + HealthChecksUI__HealthChecks__4__Name: { + value: 'Ordering HTTP Check' + } + HealthChecksUI__HealthChecks__4__Uri: { + value: 'http://ordering-api:5102/liveness' + } + HealthChecksUI__HealthChecks__5__Name: { + value: 'Basket HTTP Check' + } + HealthChecksUI__HealthChecks__5__Uri: { + value: 'http://basket-api:5103/liveness' + } + HealthChecksUI__HealthChecks__6__Name: { + value: 'Catalog HTTP Check' + } + HealthChecksUI__HealthChecks__6__Uri: { + value: 'http://catalog-api/liveness' + } + HealthChecksUI__HealthChecks__7__Name: { + value: 'Identity HTTP Check' + } + HealthChecksUI__HealthChecks__7__Uri: { + value: 'http://identity-api:5105/liveness' + } + HealthChecksUI__HealthChecks__8__Name: { + value: 'Payments HTTP Check' + } + HealthChecksUI__HealthChecks__8__Uri: { + value: 'http://payment-api:5108/liveness' + } + HealthChecksUI__HealthChecks__9__Name: { + value: 'Ordering SignalRHub HTTP Check' + } + HealthChecksUI__HealthChecks__9__Uri: { + value: 'http://ordering-signalrhub:5112/liveness' + } + HealthChecksUI__HealthChecks__10__Name: { + value: 'Ordering HTTP Background Check' + } + HealthChecksUI__HealthChecks__10__Uri: { + value: 'http://ordering-backgroundtasks:5111/liveness' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } } ports: { http: { From 979fd74953bba289c3ece23cd6ca312390200317 Mon Sep 17 00:00:00 2001 From: Karishma Chawla Date: Fri, 6 Sep 2024 14:39:08 -0700 Subject: [PATCH 06/12] Dapr Resource Schema Update (#1757) * Dapr Resource Schema Update More context: https://github.com/radius-project/radius/pull/7823 Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> * Update env vars schema Related to: https://github.com/radius-project/samples/pull/1742 Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --------- Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> Co-authored-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --- samples/dapr/dapr-azure.bicep | 12 +++- samples/dapr/dapr.bicep | 8 ++- samples/eshop-dapr/infra/dapr-pub-sub.bicep | 4 +- .../eshop-dapr/infra/dapr-secret-store.bicep | 4 +- .../eshop-dapr/infra/dapr-state-store.bicep | 20 +++++-- samples/eshop/services/web.bicep | 56 ++++++++++++++----- samples/eshop/services/webhooks.bicep | 32 ++++++++--- 7 files changed, 102 insertions(+), 34 deletions(-) diff --git a/samples/dapr/dapr-azure.bicep b/samples/dapr/dapr-azure.bicep index 88908e04..2cb18fd0 100644 --- a/samples/dapr/dapr-azure.bicep +++ b/samples/dapr/dapr-azure.bicep @@ -97,9 +97,15 @@ resource stateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = { { id: account::tableServices::table.id } ] metadata: { - accountName: account.name - accountKey: account.listKeys().keys[0].value - tableName: account::tableServices::table.name + accountName: { + value: account.name + } + accountKey: { + value: account.listKeys().keys[0].value + } + tableName: { + value: account::tableServices::table.name + } } type: 'state.azure.tablestorage' version: 'v1' diff --git a/samples/dapr/dapr.bicep b/samples/dapr/dapr.bicep index d0c79c39..860df6e5 100644 --- a/samples/dapr/dapr.bicep +++ b/samples/dapr/dapr.bicep @@ -81,8 +81,12 @@ resource stateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = { type: 'state.redis' version: 'v1' metadata: { - redisHost: '${service.metadata.name}.${namespace}.svc.cluster.local:${service.spec.ports[0].port}' - redisPassword: '' + redisHost: { + value: '${service.metadata.name}.${namespace}.svc.cluster.local:${service.spec.ports[0].port}' + } + redisPassword: { + value: '' + } } } } diff --git a/samples/eshop-dapr/infra/dapr-pub-sub.bicep b/samples/eshop-dapr/infra/dapr-pub-sub.bicep index 7a53f79c..9197454a 100644 --- a/samples/eshop-dapr/infra/dapr-pub-sub.bicep +++ b/samples/eshop-dapr/infra/dapr-pub-sub.bicep @@ -55,7 +55,9 @@ resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2023-10-01-preview' = type: 'pubsub.azure.servicebus.topics' version: 'v1' metadata: { - connectionString: serviceBus::authorizationRule.listKeys().primaryConnectionString + connectionString: { + value: serviceBus::authorizationRule.listKeys().primaryConnectionString + } } } } diff --git a/samples/eshop-dapr/infra/dapr-secret-store.bicep b/samples/eshop-dapr/infra/dapr-secret-store.bicep index 52881dcc..dfa66519 100644 --- a/samples/eshop-dapr/infra/dapr-secret-store.bicep +++ b/samples/eshop-dapr/infra/dapr-secret-store.bicep @@ -56,7 +56,9 @@ resource daprSecretStore 'Applications.Dapr/secretStores@2023-10-01-preview' = { type: 'secretstores.azure.keyvault' version: 'v1' metadata: { - vaultName: keyVaultName + vaultName: { + value: keyVaultName + } } } } diff --git a/samples/eshop-dapr/infra/dapr-state-store.bicep b/samples/eshop-dapr/infra/dapr-state-store.bicep index e12b82b9..e6b52bff 100644 --- a/samples/eshop-dapr/infra/dapr-state-store.bicep +++ b/samples/eshop-dapr/infra/dapr-state-store.bicep @@ -90,11 +90,21 @@ resource daprStateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = { type: 'state.azure.cosmosdb' version: 'v1' metadata: { - url: cosmosAccount.properties.documentEndpoint - masterKey: cosmosAccount.listKeys().primaryMasterKey - database: cosmosDbName - collection: cosmosDbCollectionName - actorStateStore: 'true' + url: { + value: cosmosAccount.properties.documentEndpoint + } + masterKey: { + value: cosmosAccount.listKeys().primaryMasterKey + } + database: { + value: cosmosDbName + } + collection: { + value: cosmosDbCollectionName + } + actorStateStore: { + value: 'true' + } } } } diff --git a/samples/eshop/services/web.bicep b/samples/eshop/services/web.bicep index e7448796..ea76c22a 100644 --- a/samples/eshop/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -114,20 +114,48 @@ resource webmvc 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webmvc:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/webmvc' - UseCustomizationData: 'False' - DPConnectionString: redisKeystore.listSecrets().connectionString - UseLoadTest: 'False' - ORCHESTRATOR_TYPE: 'K8S' - IsClusterEnv: 'True' - ExternalPurchaseUrl: '${gateway.properties.url}/webshoppingapigw' - CallBackUrl: '${gateway.properties.url}/webmvc' - IdentityUrl: '${gateway.properties.url}/identity-api' - IdentityUrlHC: 'http://identity-api:5105/liveness' - PurchaseUrl: 'http://webshoppingapigw:5202' - SignalrHubUrl: 'http://ordering-signalrhub:5112' + ASPNETCORE_ENVIRONMENT: { + value: 'Development' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + PATH_BASE: { + value: '/webmvc' + } + UseCustomizationData: { + value: 'False' + } + DPConnectionString: { + value: redisKeystore.listSecrets().connectionString + } + UseLoadTest: { + value: 'False' + } + ORCHESTRATOR_TYPE: { + value: 'K8S' + } + IsClusterEnv: { + value: 'True' + } + ExternalPurchaseUrl: { + value: '${gateway.properties.url}/webshoppingapigw' + } + CallBackUrl: { + value: '${gateway.properties.url}/webmvc' + } + IdentityUrl: { + value: '${gateway.properties.url}/identity-api' + } + IdentityUrlHC: { + value: 'http://identity-api:5105/liveness' + } + PurchaseUrl: { + value: 'http://webshoppingapigw:5202' + } + SignalrHubUrl: { + value: 'http://ordering-signalrhub:5112' + } } ports: { http: { diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index fab5fe99..80aeac87 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -104,14 +104,30 @@ resource webhooksclient 'Applications.Core/containers@2023-10-01-preview' = { container: { image: '${imageRegistry}/webhooks.client:${imageTag}' env: { - ASPNETCORE_ENVIRONMENT: 'Production' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/webhooks-web' - Token: 'WebHooks-Demo-Web' - CallBackUrl: '${gateway.properties.url}/webhooks-client' - SelfUrl: 'http://webhooks-client:5114' - WebhooksUrl: 'http://webhooks-api:5113' - IdentityUrl: '${gateway.properties.url}/identity-api' + ASPNETCORE_ENVIRONMENT: { + value: 'Production' + } + ASPNETCORE_URLS: { + value: 'http://0.0.0.0:80' + } + PATH_BASE: { + value: '/webhooks-web' + } + Token: { + value: 'WebHooks-Demo-Web' + } + CallBackUrl: { + value: '${gateway.properties.url}/webhooks-client' + } + SelfUrl: { + value: 'http://webhooks-client:5114' + } + WebhooksUrl: { + value: 'http://webhooks-api:5113' + } + IdentityUrl: { + value: '${gateway.properties.url}/identity-api' + } } ports: { http: { From efa2f1ae70b2602836c3234eb5072fddd0ae808a Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 12 Sep 2024 14:03:14 -0700 Subject: [PATCH 07/12] Change references in samples tests to correct versions (#1790) * fixing release version issues Signed-off-by: willdavsmith * fixing release version issues Signed-off-by: willdavsmith * fixing release version issues Signed-off-by: willdavsmith --------- Signed-off-by: willdavsmith --- .github/scripts/release-samples.sh | 16 ++++++++ .github/workflows/test.yaml | 61 ++++++++++++++++++++++++------ 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/.github/scripts/release-samples.sh b/.github/scripts/release-samples.sh index 9c6d7764..115dc9a0 100755 --- a/.github/scripts/release-samples.sh +++ b/.github/scripts/release-samples.sh @@ -37,6 +37,22 @@ echo "Channel version: ${CHANNEL_VERSION}" echo "Creating release branch for ${REPOSITORY}..." pushd $REPOSITORY + git checkout -B "${CHANNEL_VERSION}" + +# Update bicepconfig.json br:biceptypes.azurecr.io/radius with the CHANNEL +BICEPCONFIG_RADIUS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/radius:${CHANNEL}" +awk -v REPLACEMENT="${BICEPCONFIG_RADIUS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/radius:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json +mv bicepconfig_updated.json bicepconfig.json + +# Update bicepconfig.json br:biceptypes.azurecr.io/aws with the CHANNEL +BICEPCONFIG_AWS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/aws:${CHANNEL}" +awk -v REPLACEMENT="${BICEPCONFIG_AWS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/aws:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json +mv bicepconfig_updated.json bicepconfig.json + +# Push changes to GitHub +git add --all +git commit -m "Update samples for ${VERSION}" git push origin "${CHANNEL_VERSION}" + popd diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 750fd9ad..dd24922b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,9 +4,8 @@ on: workflow_dispatch: inputs: version: - description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge." + description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge)." required: false - default: "edge" type: string push: branches: @@ -93,7 +92,6 @@ jobs: credential: aws enableDapr: false env: - BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} AZURE_LOCATION: westus3 AWS_REGION: us-west-2 @@ -123,6 +121,49 @@ jobs: echo "TEST_EKS_CLUSTER_NAME=eks-${RUN_IDENTIFIER}" >> $GITHUB_OUTPUT echo "RUN_TEST=${RUN_TEST}" >> $GITHUB_OUTPUT echo "ENABLE_DAPR=${ENABLE_DAPR}" >> $GITHUB_OUTPUT + - name: Generate Radius version variables + id: gen-radius-version + if: steps.gen-id.outputs.RUN_TEST == 'true' + run: | + RADIUS_VERSION=edge + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + RADIUS_VERSION=${{ github.event.inputs.version }} + elif [[ "${{ github.event_name }}" == "push" ]]; then + # Get the target branch of the push event + TARGET_BRANCH=${{ github.ref }} + if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then + # Example: refs/heads/v0.1 -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + fi + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + # Get the target branch of the pull request + TARGET_BRANCH=${{ github.event.pull_request.base.ref }} + if [[ "$TARGET_BRANCH" == "edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/pull/v[0-9]+\.[0-9]+/merge$ ]]; then + # Example: refs/pull/v0.1/merge -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + fi + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + # Get the branch of the schedule event + TARGET_BRANCH=${{ github.ref }} + if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then + RADIUS_VERSION=edge + elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then + # Example: refs/heads/v0.1 -> 0.1 + RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2) + else + echo "Invalid branch name: $TARGET_BRANCH" + exit 1 + fi + else + echo "Invalid event name: ${{ github.event_name }}" + exit 1 + fi + + echo "RADIUS_VERSION=$RADIUS_VERSION" >> $GITHUB_OUTPUT - name: Checkout code if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/checkout@v4 @@ -213,11 +254,7 @@ jobs: - name: Download rad CLI if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - RADIUS_VERSION="${{ inputs.version }}" - if [[ -z "${{ inputs.version }}" ]]; then - RADIUS_VERSION=edge - fi - ./.github/scripts/install-radius.sh $RADIUS_VERSION + ./.github/scripts/install-radius.sh ${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} - name: Initialize default environment if: steps.gen-id.outputs.RUN_TEST == 'true' run: | @@ -231,10 +268,10 @@ jobs: rad group switch default rad env create default rad env switch default - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest --resource-type Applications.Datastores/sqlDatabases - rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest --resource-type Applications.Messaging/rabbitMQQueues + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/redisCaches + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/mongoDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/sqlDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Messaging/rabbitMQQueues - name: Configure cloud credentials if: steps.gen-id.outputs.RUN_TEST == 'true' && ( matrix.credential == 'azure' || matrix.credential == 'aws') run: | From 8e9943d4f022a85749315ce9b53f713d186e1101 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Fri, 13 Sep 2024 10:50:59 -0700 Subject: [PATCH 08/12] Add Purge AWS resources workflow (#1796) * Adding Purge AWS test resources workflow Signed-off-by: willdavsmith * fix Signed-off-by: willdavsmith --------- Signed-off-by: willdavsmith --- .github/scripts/purge-aws-resources.sh | 75 +++++++++++++++++++ .../workflows/purge-aws-test-resources.yaml | 40 ++++++++++ 2 files changed, 115 insertions(+) create mode 100644 .github/scripts/purge-aws-resources.sh create mode 100644 .github/workflows/purge-aws-test-resources.yaml diff --git a/.github/scripts/purge-aws-resources.sh b/.github/scripts/purge-aws-resources.sh new file mode 100644 index 00000000..76c5b80e --- /dev/null +++ b/.github/scripts/purge-aws-resources.sh @@ -0,0 +1,75 @@ +# ------------------------------------------------------------ +# 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. +# ------------------------------------------------------------ + +RESOURCE_TYPES='AWS::RDS::DBInstance,AWS::RDS::DBSubnetGroup,AWS::MemoryDB::Cluster,AWS::MemoryDB::SubnetGroup' + +# File to store the list of deleted resources +DELETED_RESOURCES_FILE='deleted-resources.txt' + +# Number of retries +MAX_RETRIES=5 + +# Retry delay in seconds +RETRY_DELAY=300 # 5 minutes + +function delete_aws_resources() { + # Empty the file + truncate -s 0 $DELETED_RESOURCES_FILE + + for resource_type in ${RESOURCE_TYPES//,/ }; do + aws cloudcontrol list-resources --type-name "$resource_type" --query "ResourceDescriptions[].Identifier" --output text | tr '\t' '\n' | while read identifier; do + aws cloudcontrol get-resource --type-name "$resource_type" --identifier "$identifier" --query "ResourceDescription.Properties" --output text | while read resource; do + echo "Deleting resource of type: $resource_type with identifier: $identifier" + echo "$identifier\n" >>$DELETED_RESOURCES_FILE + aws cloudcontrol delete-resource --type-name "$resource_type" --identifier "$identifier" + done + done + done + + if [ -s $DELETED_RESOURCES_FILE ]; then + return 1 + else + return 0 + fi +} + +RETRY_COUNT=0 +while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do + # Trigger the function to delete the resources + delete_aws_resources + + # If the function returned 0, then no resources needed to be deleted + # on this run. This means that all resources have been deleted. + if [ $? -eq 0 ]; then + echo "All resources deleted successfully" + break + fi + + # Still have resources to delete, increase the retry count + RETRY_COUNT=$((RETRY_COUNT + 1)) + + # Check if there are more retries left + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then + # Retry after delay + echo "Retrying in $RETRY_DELAY seconds..." + sleep $RETRY_DELAY + fi +done + +# Check if the maximum number of retries exceeded +if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then + echo "Maximum number of retries exceeded" +fi diff --git a/.github/workflows/purge-aws-test-resources.yaml b/.github/workflows/purge-aws-test-resources.yaml new file mode 100644 index 00000000..e5cb97ca --- /dev/null +++ b/.github/workflows/purge-aws-test-resources.yaml @@ -0,0 +1,40 @@ +name: Purge AWS Test Resources + +on: + schedule: + # Runs every day at 5 AM + - cron: "0 5 * * *" + +env: + GH_TOKEN: ${{ github.token }} + AWS_REGION: us-west-2 + +jobs: + purge_aws_resources: + name: Purge AWS Test Resources + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install AWS CLI + run: | + sudo apt-get update + sudo apt-get install -y awscli + + - name: Login to AWS + run: | + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws configure set region ${{ env.AWS_REGION }} + aws configure set output json + + - name: Delete old AWS resources + run: bash .github/scripts/purge-aws-resources.sh + + - name: Create GitHub issue on failure + if: failure() && github.event_name == 'schedule' + run: | + gh issue create --title "Purge Purge AWS Test Resources workflow failed" \ + --body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \ + --repo ${{ github.repository }} From 831b84bde504a0c4114544686d2ea4fb77292a9e Mon Sep 17 00:00:00 2001 From: Karishma Chawla Date: Fri, 13 Sep 2024 11:43:41 -0700 Subject: [PATCH 09/12] Add command to automate issue assignment (#1746) Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> Co-authored-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --- .github/scripts/radius-bot.js | 75 +++++++++++++++++++++++++++++++ .github/workflows/radius-bot.yaml | 24 ++++++++++ 2 files changed, 99 insertions(+) create mode 100644 .github/scripts/radius-bot.js create mode 100644 .github/workflows/radius-bot.yaml diff --git a/.github/scripts/radius-bot.js b/.github/scripts/radius-bot.js new file mode 100644 index 00000000..72c6a55e --- /dev/null +++ b/.github/scripts/radius-bot.js @@ -0,0 +1,75 @@ +/* +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. +*/ + +module.exports = async ({ github, context }) => { + if (context.eventName === 'issue_comment' && context.payload.action === 'created') { + try { + await handleIssueCommentCreate({ github, context }); + } catch (error) { + console.log(`[handleIssueCommentCreate] unexpected error: ${error}`); + } + } +} + +// Handle issue comment create event. +async function handleIssueCommentCreate({ github, context }) { + const payload = context.payload; + const issue = context.issue; + const isFromPulls = !!payload.issue.pull_request; + const commentBody = payload.comment.body; + const username = context.actor; + + if (!commentBody) { + console.log('[handleIssueCommentCreate] comment body not found, exiting.'); + return; + } + + const commandParts = commentBody.split(/\s+/); + const command = commandParts.shift(); + + switch (command) { + case '/assign': + await cmdAssign(github, issue, isFromPulls, username); + break; + default: + console.log(`[handleIssueCommentCreate] command ${command} not found, exiting.`); + break; + } +} + +/** + * Assign issue to the user who commented. + * @param {*} github GitHub object reference + * @param {*} issue GitHub issue object + * @param {*} isFromPulls is the workflow triggered by a pull request? + * @param {*} username is the user who trigger the command + */ +async function cmdAssign(github, issue, isFromPulls, username) { + if (isFromPulls) { + console.log('[cmdAssign] pull requests not supported, skipping command execution.'); + return; + } else if (issue.assignees && issue.assignees.length !== 0) { + console.log('[cmdAssign] issue already has assignees, skipping command execution.'); + return; + } + + await github.rest.issues.addAssignees({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + assignees: [username], + }); +} diff --git a/.github/workflows/radius-bot.yaml b/.github/workflows/radius-bot.yaml new file mode 100644 index 00000000..6b343d1b --- /dev/null +++ b/.github/workflows/radius-bot.yaml @@ -0,0 +1,24 @@ +name: radius-bot + +on: + issue_comment: + types: [created] + +jobs: + radius-bot: + name: Run Radius Bot script + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/scripts/radius-bot.js + sparse-checkout-cone-mode: false + - name: Comment analyzer + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} + script: | + const script = require('./.github/scripts/radius-bot.js') + await script({github, context}) From 4b9600b1ba5846784dc8ae3dca8c4a57c5f91240 Mon Sep 17 00:00:00 2001 From: rad-ci-bot <103787451+rad-ci-bot@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:23:08 -0700 Subject: [PATCH 10/12] Set bicep extension and remove workspace path (#1738) (#1803) Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Co-authored-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fe248053..6e8e04b1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,6 @@ { "name": "Radius Dev Container", "image": "mcr.microsoft.com/devcontainers/universal:linux", - "workspaceFolder": "/workspaces/samples", "onCreateCommand": "bash ./.devcontainer/on-create.sh", "postCreateCommand": "bash ./.devcontainer/post-create.sh", "runArgs": [ @@ -27,7 +26,7 @@ "ms-python.python", "dunn.redis", "GitHub.copilot", - "ms-azuretools.rad-vscode-bicep" + "ms-azuretools.vscode-bicep" ] } }, From dfcfabb1b12f21e55be40cba2d8f8174b4b3d5d4 Mon Sep 17 00:00:00 2001 From: Radius CI Bot Date: Mon, 16 Sep 2024 20:44:21 +0000 Subject: [PATCH 11/12] Update samples for --- bicepconfig.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bicepconfig.json b/bicepconfig.json index a034f8ce..e7f47ea3 100644 --- a/bicepconfig.json +++ b/bicepconfig.json @@ -5,10 +5,10 @@ "dynamicTypeLoading": true }, "extensions": { - "radius": "br:biceptypes.azurecr.io/radius:latest", - "aws": "br:biceptypes.azurecr.io/aws:latest" + "radius": "br:biceptypes.azurecr.io/radius:0.38", + "aws": "br:biceptypes.azurecr.io/aws:0.38" }, "cloud": { "credentialPrecedence": [ "Environment" ] } -} \ No newline at end of file +} From 5f2910012282743149c18066560bf8da0f26687d Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 19 Sep 2024 16:31:05 -0700 Subject: [PATCH 12/12] Fix samples test issue with release channel version (#1850) * adding channel to install-rad functionality Signed-off-by: willdavsmith * adding channel to install-rad functionality Signed-off-by: willdavsmith --------- Signed-off-by: willdavsmith --- .github/scripts/install-radius.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/scripts/install-radius.sh b/.github/scripts/install-radius.sh index f12ac62b..d2ac3974 100755 --- a/.github/scripts/install-radius.sh +++ b/.github/scripts/install-radius.sh @@ -16,6 +16,8 @@ set -xe +# VERSION is the version of the rad CLI to download +# e.g. 0.1, 0.1.0, 0.1.0-rc1, edge VERSION=$1 RAD_CLI_URL=https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh RAD_CLI_EDGE_URL=ghcr.io/radius-project/rad/linux-amd64:latest @@ -26,8 +28,25 @@ if [[ $VERSION == "edge" ]]; then chmod +x ./rad mv ./rad /usr/local/bin/rad elif [[ -n $VERSION ]]; then - echo Downloading rad CLI version $VERSION - wget -q $RAD_CLI_URL -O - | /bin/bash -s $VERSION + RADIUS_VERSION=$VERSION + # if version is a channel, e.g. 0.1 + if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then + echo "Querying the most recent version of the specified channel: $VERSION" + RADIUS_VERSION=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/radius-project/radius/releases | jq -r '.[] | .tag_name | select(startswith("v'$VERSION'"))' | head -n 1) + echo "Found version $RADIUS_VERSION" + if [[ -z "$RADIUS_VERSION" ]]; then + echo "No releases found for channel $VERSION" + exit 1 + fi + else + echo "The string does not match the pattern [anynumber].[anynumber]" + fi + + # remove the 'v' prefix + RADIUS_VERSION=$(echo $RADIUS_VERSION | cut -d "v" -f 2) + + echo Downloading rad CLI version $RADIUS_VERSION + wget -q $RAD_CLI_URL -O - | /bin/bash -s $RADIUS_VERSION else echo Downloading latest rad CLI wget -q $RAD_CLI_URL -O - | /bin/bash