From 8396a50958735f9a47cada827d6994ea8d68a5ee Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 00:38:14 -0400 Subject: [PATCH 01/14] wip --- .github/workflows/run-tests.yml | 8 ++++++++ .github/workflows/tests.yml | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9d09b2e07a4..9686aa1692d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -152,6 +152,14 @@ jobs: run: | ${{ env.BUILD_SCRIPT }} -restore -ci -build -projects ${{ env.TEST_PROJECT_PATH }} + - name: Check Playground manifests + if: ${{ inputs.os == 'windows-latest' }} + env: + CI: false + run: | + (cd eng && pwsh ./refreshManifests.ps1) && + git diff --exit-code -- playground + - name: Build and archive test project if: ${{ inputs.requiresNugets }} env: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e2ab76acb8..5b0507ea3cc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -134,11 +134,22 @@ jobs: testProjectPath: tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj requiresNugets: true + playground_tests: + name: Playground ${{ matrix.os }} + uses: ./.github/workflows/run-tests.yml + needs: build_packages + with: + testShortName: Playground + # Playground is not run on Windows due to missing Docker support + os: ubuntu-latest + testProjectPath: tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj + requiresNugets: true + results: # This job is used for branch protection. It ensures all the above tests passed if: ${{ always() }} runs-on: ubuntu-latest name: Final Results - needs: [ integrations_test_lin, integrations_test_win, templates_test_lin, templates_test_win, endtoend_tests ] + needs: [ integrations_test_lin, integrations_test_win, templates_test_lin, templates_test_win, endtoend_tests, playground_tests ] steps: # get all the test-job-result* artifacts into a single directory - uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 From b19385dcf95afad102681cd60ed0994bb5a55b66 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 00:53:17 -0400 Subject: [PATCH 02/14] wip --- .github/workflows/run-tests.yml | 4 ++-- .github/workflows/tests.yml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9686aa1692d..05accda4bc6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -153,11 +153,11 @@ jobs: ${{ env.BUILD_SCRIPT }} -restore -ci -build -projects ${{ env.TEST_PROJECT_PATH }} - name: Check Playground manifests - if: ${{ inputs.os == 'windows-latest' }} + if: ${{ inputs.os == 'ubuntu-latest' && inputs.testShortName == 'Playground' }} env: CI: false run: | - (cd eng && pwsh ./refreshManifests.ps1) && + for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --no-build --publisher manifest --output-path aspire-manifest.json); done && git diff --exit-code -- playground - name: Build and archive test project diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b0507ea3cc..08771add342 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -131,7 +131,6 @@ jobs: testShortName: EndToEnd # EndToEnd is not run on Windows due to missing Docker support os: ubuntu-latest - testProjectPath: tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj requiresNugets: true playground_tests: @@ -142,7 +141,6 @@ jobs: testShortName: Playground # Playground is not run on Windows due to missing Docker support os: ubuntu-latest - testProjectPath: tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj requiresNugets: true results: # This job is used for branch protection. It ensures all the above tests passed From 5780d133be685afd7f5dd2a7dc13bf56860cf6f4 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:05:14 -0400 Subject: [PATCH 03/14] wip --- .github/workflows/run-tests.yml | 2 +- .../ServiceBus.AppHost/aspire-manifest.json | 9 +- .../aspire-manifest.json | 7 +- .../TestShop.AppHost/aspire-manifest.json | 2 +- .../BicepSample.AppHost/aspire-manifest.json | 12 +- .../CdkSample.AppHost/aspire-manifest.json | 16 +- .../Publishers.AppHost/aspire-manifest.json | 219 ++++++++++++++++-- .../Publishers.AppHost/pg.module.bicep | 109 ++++----- 8 files changed, 268 insertions(+), 108 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 05accda4bc6..cbe74470eaa 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -157,7 +157,7 @@ jobs: env: CI: false run: | - for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --no-build --publisher manifest --output-path aspire-manifest.json); done && + for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --publisher manifest --output-path aspire-manifest.json); done && git diff --exit-code -- playground - name: Build and archive test project diff --git a/playground/AzureServiceBus/ServiceBus.AppHost/aspire-manifest.json b/playground/AzureServiceBus/ServiceBus.AppHost/aspire-manifest.json index 71e101db07d..aabb39bc87b 100644 --- a/playground/AzureServiceBus/ServiceBus.AppHost/aspire-manifest.json +++ b/playground/AzureServiceBus/ServiceBus.AppHost/aspire-manifest.json @@ -12,15 +12,15 @@ }, "queueOne": { "type": "value.v0", - "connectionString": "{sbemulator.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sbemulator.outputs.serviceBusEndpoint};EntityPath=queue1" }, "topicOne": { "type": "value.v0", - "connectionString": "{sbemulator.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sbemulator.outputs.serviceBusEndpoint};EntityPath=topic1" }, "sub1": { "type": "value.v0", - "connectionString": "{sbemulator.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sbemulator.outputs.serviceBusEndpoint};EntityPath=topic1/Subscriptions/sub1" }, "worker": { "type": "project.v0", @@ -29,7 +29,8 @@ "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ConnectionStrings__sbemulator": "{sbemulator.connectionString}" + "ConnectionStrings__queueOne": "{queueOne.connectionString}", + "ConnectionStrings__sub1": "{sub1.connectionString}" } } } diff --git a/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/aspire-manifest.json b/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/aspire-manifest.json index 40df6b58e1e..63c3c2156f7 100644 --- a/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/aspire-manifest.json +++ b/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/aspire-manifest.json @@ -11,11 +11,11 @@ }, "db": { "type": "value.v0", - "connectionString": "{cosmos.outputs.connectionString}" + "connectionString": "AccountEndpoint={cosmos.outputs.connectionString};Database=db" }, "entries": { "type": "value.v0", - "connectionString": "{cosmos.outputs.connectionString}" + "connectionString": "AccountEndpoint={cosmos.outputs.connectionString};Database=db;Container=entries" }, "api": { "type": "project.v0", @@ -26,7 +26,8 @@ "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{api.bindings.http.targetPort}", - "ConnectionStrings__cosmos": "{cosmos.connectionString}" + "ConnectionStrings__db": "{db.connectionString}", + "ConnectionStrings__entries": "{entries.connectionString}" }, "bindings": { "http": { diff --git a/playground/TestShop/TestShop.AppHost/aspire-manifest.json b/playground/TestShop/TestShop.AppHost/aspire-manifest.json index e438d6dea6b..e76f4638a97 100644 --- a/playground/TestShop/TestShop.AppHost/aspire-manifest.json +++ b/playground/TestShop/TestShop.AppHost/aspire-manifest.json @@ -69,7 +69,7 @@ "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{catalogdbapp.bindings.http.targetPort}", "ConnectionStrings__catalogdb": "{catalogdb.connectionString}", - "DatabaseResetKey": "6b85bcc5-617c-488b-b62f-f6134cf8a7d6" + "DatabaseResetKey": "a3572757-c9b9-403c-b011-bf133d9e16bb" }, "bindings": { "http": { diff --git a/playground/bicep/BicepSample.AppHost/aspire-manifest.json b/playground/bicep/BicepSample.AppHost/aspire-manifest.json index 6e65b6d1eaf..f6c784e708c 100644 --- a/playground/bicep/BicepSample.AppHost/aspire-manifest.json +++ b/playground/bicep/BicepSample.AppHost/aspire-manifest.json @@ -172,27 +172,27 @@ }, "queue1": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=queue1" }, "topic1": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=topic1" }, "subscription1": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=topic1/Subscriptions/subscription1" }, "subscription2": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=topic1/Subscriptions/subscription2" }, "topic2": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=topic2" }, "topic2sub": { "type": "value.v0", - "connectionString": "{sb.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={sb.outputs.serviceBusEndpoint};EntityPath=topic2/Subscriptions/subscription1" }, "signalr": { "type": "azure.bicep.v0", diff --git a/playground/cdk/CdkSample.AppHost/aspire-manifest.json b/playground/cdk/CdkSample.AppHost/aspire-manifest.json index d90b6fe7958..4cf1bad70fa 100644 --- a/playground/cdk/CdkSample.AppHost/aspire-manifest.json +++ b/playground/cdk/CdkSample.AppHost/aspire-manifest.json @@ -154,35 +154,35 @@ }, "queue1": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=queue1" }, "topic1": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic1" }, "subscription2": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic1/Subscriptions/subscription2" }, "topic2": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic2" }, "subscription1": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic2/Subscriptions/subscription1" }, "topic3": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic3" }, "sub1": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic3/Subscriptions/sub1" }, "sub2": { "type": "value.v0", - "connectionString": "{servicebus.outputs.serviceBusEndpoint}" + "connectionString": "Endpoint={servicebus.outputs.serviceBusEndpoint};EntityPath=topic3/Subscriptions/sub2" }, "appConfig": { "type": "azure.bicep.v0", diff --git a/playground/publishers/Publishers.AppHost/aspire-manifest.json b/playground/publishers/Publishers.AppHost/aspire-manifest.json index 1ee090f738a..16c5d0f534d 100644 --- a/playground/publishers/Publishers.AppHost/aspire-manifest.json +++ b/playground/publishers/Publishers.AppHost/aspire-manifest.json @@ -1,23 +1,108 @@ { "$schema": "https://json.schemastore.org/aspire-8.0.json", "resources": { - "pg": { + "env": { "type": "azure.bicep.v0", - "connectionString": "{pg.secretOutputs.connectionString}", - "path": "pg.module.bicep", + "path": "env.module.bicep", "params": { - "administratorLogin": "{pg-username.value}", - "administratorLoginPassword": "{pg-password.value}", - "keyVaultName": "" + "userPrincipalId": "" + } + }, + "param0": { + "type": "parameter.v0", + "value": "{param0.inputs.value}", + "inputs": { + "value": { + "type": "string" + } + } + }, + "param1": { + "type": "parameter.v0", + "value": "{param1.inputs.value}", + "inputs": { + "value": { + "type": "string", + "secret": true + } + } + }, + "param2": { + "type": "parameter.v0", + "value": "{param2.inputs.value}", + "inputs": { + "value": { + "type": "string", + "default": { + "value": "default" + } + } + } + }, + "param3": { + "type": "parameter.v0", + "value": "{param3.inputs.value}", + "inputs": { + "value": { + "type": "string" + } + } + }, + "azpg": { + "type": "azure.bicep.v0", + "connectionString": "{azpg.outputs.connectionString}", + "path": "azpg.module.bicep" + }, + "azdb": { + "type": "value.v0", + "connectionString": "{azpg.connectionString};Database=azdb" + }, + "pg": { + "type": "container.v1", + "connectionString": "Host={pg.bindings.tcp.host};Port={pg.bindings.tcp.port};Username=postgres;Password={pg-password.value}", + "image": "docker.io/library/postgres:17.2", + "deployment": { + "type": "azure.bicep.v0", + "path": "pg.module.bicep", + "params": { + "pg_password_value": "{pg-password.value}", + "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}" + } + }, + "env": { + "POSTGRES_HOST_AUTH_METHOD": "scram-sha-256", + "POSTGRES_INITDB_ARGS": "--auth-host=scram-sha-256 --auth-local=scram-sha-256", + "POSTGRES_USER": "postgres", + "POSTGRES_PASSWORD": "{pg-password.value}" + }, + "bindings": { + "tcp": { + "scheme": "tcp", + "protocol": "tcp", + "transport": "tcp", + "targetPort": 5432 + } } }, "db": { "type": "value.v0", - "connectionString": "{pg.secretOutputs.db-connectionString}" + "connectionString": "{pg.connectionString};Database=db" }, "dbsetup": { - "type": "project.v0", - "path": "../WaitForSandbox.DbSetup/WaitForSandbox.DbSetup.csproj", + "type": "project.v1", + "path": "../Publishers.DbSetup/Publishers.DbSetup.csproj", + "deployment": { + "type": "azure.bicep.v0", + "path": "dbsetup.module.bicep", + "params": { + "dbsetup_containerport": "{dbsetup.containerPort}", + "pg_password_value": "{pg-password.value}", + "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", + "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", + "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", + "dbsetup_containerimage": "{dbsetup.containerImage}" + } + }, "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", @@ -40,15 +125,31 @@ } }, "api": { - "type": "project.v0", - "path": "../WaitForSandbox.ApiService/WaitForSandbox.ApiService.csproj", + "type": "project.v1", + "path": "../Publishers.ApiService/Publishers.ApiService.csproj", + "deployment": { + "type": "azure.bicep.v0", + "path": "api.module.bicep", + "params": { + "api_identity_outputs_id": "{api-identity.outputs.id}", + "api_identity_outputs_clientid": "{api-identity.outputs.clientId}", + "api_containerport": "{api.containerPort}", + "pg_password_value": "{pg-password.value}", + "azpg_outputs_connectionstring": "{azpg.outputs.connectionString}", + "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", + "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", + "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", + "api_containerimage": "{api.containerImage}" + } + }, "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{api.bindings.http.targetPort}", - "ConnectionStrings__db": "{db.connectionString}" + "ConnectionStrings__db": "{db.connectionString}", + "ConnectionStrings__azdb": "{azdb.connectionString}" }, "bindings": { "http": { @@ -65,15 +166,74 @@ } } }, + "sqlserver": { + "type": "container.v1", + "connectionString": "Server={sqlserver.bindings.tcp.host},{sqlserver.bindings.tcp.port};User ID=sa;Password={sqlserver-password.value};TrustServerCertificate=true", + "image": "mcr.microsoft.com/mssql/server:2022-latest", + "deployment": { + "type": "azure.bicep.v0", + "path": "sqlserver.module.bicep", + "params": { + "env_outputs_volumes_sqlserver_0": "{env.outputs.volumes_sqlserver_0}", + "sqlserver_password_value": "{sqlserver-password.value}", + "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}" + } + }, + "volumes": [ + { + "name": "sqlserver-data", + "target": "/var/opt/mssql", + "readOnly": false + } + ], + "env": { + "ACCEPT_EULA": "Y", + "MSSQL_SA_PASSWORD": "{sqlserver-password.value}" + }, + "bindings": { + "tcp": { + "scheme": "tcp", + "protocol": "tcp", + "transport": "tcp", + "targetPort": 1433 + } + } + }, + "sqldb": { + "type": "value.v0", + "connectionString": "{sqlserver.connectionString};Initial Catalog=sqldb" + }, "frontend": { - "type": "project.v0", - "path": "../WaitFor.Frontend/WaitFor.Frontend.csproj", + "type": "project.v1", + "path": "../Publishers.Frontend/Publishers.Frontend.csproj", + "deployment": { + "type": "azure.bicep.v0", + "path": "frontend.module.bicep", + "params": { + "frontend_containerport": "{frontend.containerPort}", + "sqlserver_password_value": "{sqlserver-password.value}", + "param0_value": "{param0.value}", + "param1_value": "{param1.value}", + "param2_value": "{param2.value}", + "param3_value": "{param3.value}", + "env_outputs_azure_container_apps_environment_default_domain": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN}", + "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", + "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", + "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", + "frontend_containerimage": "{frontend.containerImage}" + } + }, "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{frontend.bindings.http.targetPort}", + "ConnectionStrings__sqldb": "{sqldb.connectionString}", + "P0": "{param0.value}", + "P1": "{param1.value}", + "P2": "{param2.value}", + "P3": "{param3.value}", "services__api__http__0": "{api.bindings.http.url}", "services__api__https__0": "{api.bindings.https.url}" }, @@ -90,32 +250,47 @@ } } }, - "pg-username": { + "api-identity": { + "type": "azure.bicep.v0", + "path": "api-identity.module.bicep" + }, + "api-roles-azpg": { + "type": "azure.bicep.v0", + "path": "api-roles-azpg.module.bicep", + "params": { + "azpg_outputs_name": "{azpg.outputs.name}", + "principalId": "{api-identity.outputs.principalId}", + "principalName": "{api-identity.outputs.principalName}" + } + }, + "pg-password": { "type": "parameter.v0", - "value": "{pg-username.inputs.value}", + "value": "{pg-password.inputs.value}", "inputs": { "value": { "type": "string", + "secret": true, "default": { "generate": { - "minLength": 10, - "numeric": false, - "special": false + "minLength": 22 } } } } }, - "pg-password": { + "sqlserver-password": { "type": "parameter.v0", - "value": "{pg-password.inputs.value}", + "value": "{sqlserver-password.inputs.value}", "inputs": { "value": { "type": "string", "secret": true, "default": { "generate": { - "minLength": 22 + "minLength": 22, + "minLower": 1, + "minUpper": 1, + "minNumeric": 1 } } } diff --git a/playground/publishers/Publishers.AppHost/pg.module.bicep b/playground/publishers/Publishers.AppHost/pg.module.bicep index 56c31a454fd..34d363ae27b 100644 --- a/playground/publishers/Publishers.AppHost/pg.module.bicep +++ b/playground/publishers/Publishers.AppHost/pg.module.bicep @@ -1,75 +1,58 @@ @description('The location for the resource(s) to be deployed.') param location string = resourceGroup().location -param administratorLogin string - @secure() -param administratorLoginPassword string +param pg_password_value string -param keyVaultName string +param env_outputs_azure_container_apps_environment_id string -resource pg 'Microsoft.DBforPostgreSQL/flexibleServers@2024-08-01' = { - name: take('pg-${uniqueString(resourceGroup().id)}', 63) +resource pg 'Microsoft.App/containerApps@2024-03-01' = { + name: 'pg' location: location properties: { - administratorLogin: administratorLogin - administratorLoginPassword: administratorLoginPassword - authConfig: { - activeDirectoryAuth: 'Disabled' - passwordAuth: 'Enabled' - } - availabilityZone: '1' - backup: { - backupRetentionDays: 7 - geoRedundantBackup: 'Disabled' + configuration: { + secrets: [ + { + name: 'postgres-password' + value: pg_password_value + } + ] + activeRevisionsMode: 'Single' + ingress: { + external: false + targetPort: 5432 + transport: 'tcp' + } } - highAvailability: { - mode: 'Disabled' + environmentId: env_outputs_azure_container_apps_environment_id + template: { + containers: [ + { + image: 'docker.io/library/postgres:17.2' + name: 'pg' + env: [ + { + name: 'POSTGRES_HOST_AUTH_METHOD' + value: 'scram-sha-256' + } + { + name: 'POSTGRES_INITDB_ARGS' + value: '--auth-host=scram-sha-256 --auth-local=scram-sha-256' + } + { + name: 'POSTGRES_USER' + value: 'postgres' + } + { + name: 'POSTGRES_PASSWORD' + secretRef: 'postgres-password' + } + ] + } + ] + scale: { + minReplicas: 1 + } } - storage: { - storageSizeGB: 32 - } - version: '16' - } - sku: { - name: 'Standard_B1ms' - tier: 'Burstable' - } - tags: { - 'aspire-resource-name': 'pg' - } -} - -resource postgreSqlFirewallRule_AllowAllAzureIps 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2024-08-01' = { - name: 'AllowAllAzureIps' - properties: { - endIpAddress: '0.0.0.0' - startIpAddress: '0.0.0.0' - } - parent: pg -} - -resource db 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2024-08-01' = { - name: 'db' - parent: pg -} - -resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = { - name: keyVaultName -} - -resource connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = { - name: 'connectionString' - properties: { - value: 'Host=${pg.properties.fullyQualifiedDomainName};Username=${administratorLogin};Password=${administratorLoginPassword}' - } - parent: keyVault -} - -resource db_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = { - name: 'db-connectionString' - properties: { - value: 'Host=${pg.properties.fullyQualifiedDomainName};Username=${administratorLogin};Password=${administratorLoginPassword};Database=db' } - parent: keyVault } \ No newline at end of file From b3d149067401f2372408314c43f2ed2a81337bdd Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:26:19 -0400 Subject: [PATCH 04/14] wip --- .github/workflows/run-tests.yml | 3 ++- .github/workflows/tests.yml | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cbe74470eaa..121c6865b4a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -157,7 +157,8 @@ jobs: env: CI: false run: | - for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --publisher manifest --output-path aspire-manifest.json); done && + ./build.sh -testnobuild && + for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --no-build --publisher manifest --output-path aspire-manifest.json); done && git diff --exit-code -- playground - name: Build and archive test project diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08771add342..550c789964e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -133,21 +133,21 @@ jobs: os: ubuntu-latest requiresNugets: true - playground_tests: - name: Playground ${{ matrix.os }} - uses: ./.github/workflows/run-tests.yml - needs: build_packages - with: - testShortName: Playground - # Playground is not run on Windows due to missing Docker support - os: ubuntu-latest - requiresNugets: true + #playground_tests: + #name: Playground ${{ matrix.os }} + #uses: ./.github/workflows/run-tests.yml + #needs: build_packages + #with: + #testShortName: Playground + ## Playground is not run on Windows due to missing Docker support + #os: ubuntu-latest + #requiresNugets: true results: # This job is used for branch protection. It ensures all the above tests passed if: ${{ always() }} runs-on: ubuntu-latest name: Final Results - needs: [ integrations_test_lin, integrations_test_win, templates_test_lin, templates_test_win, endtoend_tests, playground_tests ] + needs: [ integrations_test_lin, integrations_test_win, templates_test_lin, templates_test_win, endtoend_tests ] steps: # get all the test-job-result* artifacts into a single directory - uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 From 53ce0d08fb5623f9ebafc996d38842ca72ba7423 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:31:59 -0400 Subject: [PATCH 05/14] wip --- .github/workflows/tests.yml | 2 +- eng/Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 550c789964e..deffe741c13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,7 +55,7 @@ jobs: - name: Build with packages env: CI: false - run: ./build.sh -restore -build -ci -pack -testnobuild /bl /p:InstallBrowsersForPlaywright=false + run: ./build.sh -restore -build -ci -pack -testnobuild /bl /p:InstallBrowsersForPlaywright=false /p:SkipPlaygroundAppBuilds=true - name: Upload built NuGets uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 diff --git a/eng/Build.props b/eng/Build.props index 6ffe7e164b4..f7ede046889 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -3,7 +3,7 @@ - + From 86f8f24150055fc103021d817edbae7a67350aea Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:40:01 -0400 Subject: [PATCH 06/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 121c6865b4a..e49180e2d94 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -158,7 +158,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - for f in `find playground -name '*.AppHost.csproj'`; do (echo "Generating manifest for $f"; cd $(dirname $f); dotnet run --no-build --publisher manifest --output-path aspire-manifest.json); done && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run $f --no-build --publisher manifest --output-path $f/aspire-manifest.json || exit 1; done) && git diff --exit-code -- playground - name: Build and archive test project From 72add5fe94552a66e56026f9760aee2ac8b30b69 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:45:40 -0400 Subject: [PATCH 07/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e49180e2d94..0e0d5f7f5dd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -158,7 +158,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run $f --no-build --publisher manifest --output-path $f/aspire-manifest.json || exit 1; done) && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $f/aspire-manifest.json || exit 1; done) && git diff --exit-code -- playground - name: Build and archive test project From b716904d065b45f96a51f7d94b41b380550f7e60 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:50:10 -0400 Subject: [PATCH 08/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0e0d5f7f5dd..5c0ca7921cf 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -158,7 +158,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $f/aspire-manifest.json || exit 1; done) && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path aspire-manifest.json || exit 1; done) && git diff --exit-code -- playground - name: Build and archive test project From a376e44955ed0b74807aa56e0e97898a4bf139f7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 01:58:53 -0400 Subject: [PATCH 09/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5c0ca7921cf..d65ceab1a19 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -158,7 +158,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path aspire-manifest.json || exit 1; done) && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $(PWD)/$(dirname $f)/aspire-manifest.json || exit 1; done) && git diff --exit-code -- playground - name: Build and archive test project From 037881686f5ef0e060ebeea4f8dbf56093f8553a Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 02:03:39 -0400 Subject: [PATCH 10/14] wip --- .github/workflows/run-tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d65ceab1a19..e42227457fb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -145,22 +145,22 @@ jobs: echo "TEST_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV echo "TEST_ASSEMBLY_NAME=$filenameWithoutExtension" >> $env:GITHUB_ENV - - name: Build test project - if: ${{ ! inputs.requiresNugets }} - env: - CI: false - run: | - ${{ env.BUILD_SCRIPT }} -restore -ci -build -projects ${{ env.TEST_PROJECT_PATH }} - - name: Check Playground manifests if: ${{ inputs.os == 'ubuntu-latest' && inputs.testShortName == 'Playground' }} env: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $(PWD)/$(dirname $f)/aspire-manifest.json || exit 1; done) && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json || exit 1; done) && git diff --exit-code -- playground + - name: Build test project + if: ${{ ! inputs.requiresNugets }} + env: + CI: false + run: | + ${{ env.BUILD_SCRIPT }} -restore -ci -build -projects ${{ env.TEST_PROJECT_PATH }} + - name: Build and archive test project if: ${{ inputs.requiresNugets }} env: From 7d7f36e5eb12835326138faae5493b8e144b2f10 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 02:07:08 -0400 Subject: [PATCH 11/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e42227457fb..af92e6b2157 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -151,7 +151,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json || exit 1; done) && + (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json; done) && git diff --exit-code -- playground - name: Build test project From 127401d2f1fc2e393da3e842585be90f750f0be7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 02:11:44 -0400 Subject: [PATCH 12/14] wip --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index af92e6b2157..665825ac7d3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -151,7 +151,7 @@ jobs: CI: false run: | ./build.sh -testnobuild && - (for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json; done) && + for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json; done && git diff --exit-code -- playground - name: Build test project From 30ababbdf4e3fdc556896cd8bd216181858d9578 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Mar 2025 21:40:50 -0400 Subject: [PATCH 13/14] cleanup --- .../Publishers.AppHost/aspire-manifest.json | 219 ++---------------- .../Publishers.AppHost/pg.module.bicep | 109 +++++---- 2 files changed, 85 insertions(+), 243 deletions(-) diff --git a/playground/publishers/Publishers.AppHost/aspire-manifest.json b/playground/publishers/Publishers.AppHost/aspire-manifest.json index 16c5d0f534d..1ee090f738a 100644 --- a/playground/publishers/Publishers.AppHost/aspire-manifest.json +++ b/playground/publishers/Publishers.AppHost/aspire-manifest.json @@ -1,108 +1,23 @@ { "$schema": "https://json.schemastore.org/aspire-8.0.json", "resources": { - "env": { + "pg": { "type": "azure.bicep.v0", - "path": "env.module.bicep", + "connectionString": "{pg.secretOutputs.connectionString}", + "path": "pg.module.bicep", "params": { - "userPrincipalId": "" - } - }, - "param0": { - "type": "parameter.v0", - "value": "{param0.inputs.value}", - "inputs": { - "value": { - "type": "string" - } - } - }, - "param1": { - "type": "parameter.v0", - "value": "{param1.inputs.value}", - "inputs": { - "value": { - "type": "string", - "secret": true - } - } - }, - "param2": { - "type": "parameter.v0", - "value": "{param2.inputs.value}", - "inputs": { - "value": { - "type": "string", - "default": { - "value": "default" - } - } - } - }, - "param3": { - "type": "parameter.v0", - "value": "{param3.inputs.value}", - "inputs": { - "value": { - "type": "string" - } - } - }, - "azpg": { - "type": "azure.bicep.v0", - "connectionString": "{azpg.outputs.connectionString}", - "path": "azpg.module.bicep" - }, - "azdb": { - "type": "value.v0", - "connectionString": "{azpg.connectionString};Database=azdb" - }, - "pg": { - "type": "container.v1", - "connectionString": "Host={pg.bindings.tcp.host};Port={pg.bindings.tcp.port};Username=postgres;Password={pg-password.value}", - "image": "docker.io/library/postgres:17.2", - "deployment": { - "type": "azure.bicep.v0", - "path": "pg.module.bicep", - "params": { - "pg_password_value": "{pg-password.value}", - "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}" - } - }, - "env": { - "POSTGRES_HOST_AUTH_METHOD": "scram-sha-256", - "POSTGRES_INITDB_ARGS": "--auth-host=scram-sha-256 --auth-local=scram-sha-256", - "POSTGRES_USER": "postgres", - "POSTGRES_PASSWORD": "{pg-password.value}" - }, - "bindings": { - "tcp": { - "scheme": "tcp", - "protocol": "tcp", - "transport": "tcp", - "targetPort": 5432 - } + "administratorLogin": "{pg-username.value}", + "administratorLoginPassword": "{pg-password.value}", + "keyVaultName": "" } }, "db": { "type": "value.v0", - "connectionString": "{pg.connectionString};Database=db" + "connectionString": "{pg.secretOutputs.db-connectionString}" }, "dbsetup": { - "type": "project.v1", - "path": "../Publishers.DbSetup/Publishers.DbSetup.csproj", - "deployment": { - "type": "azure.bicep.v0", - "path": "dbsetup.module.bicep", - "params": { - "dbsetup_containerport": "{dbsetup.containerPort}", - "pg_password_value": "{pg-password.value}", - "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", - "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", - "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", - "dbsetup_containerimage": "{dbsetup.containerImage}" - } - }, + "type": "project.v0", + "path": "../WaitForSandbox.DbSetup/WaitForSandbox.DbSetup.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", @@ -125,31 +40,15 @@ } }, "api": { - "type": "project.v1", - "path": "../Publishers.ApiService/Publishers.ApiService.csproj", - "deployment": { - "type": "azure.bicep.v0", - "path": "api.module.bicep", - "params": { - "api_identity_outputs_id": "{api-identity.outputs.id}", - "api_identity_outputs_clientid": "{api-identity.outputs.clientId}", - "api_containerport": "{api.containerPort}", - "pg_password_value": "{pg-password.value}", - "azpg_outputs_connectionstring": "{azpg.outputs.connectionString}", - "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", - "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", - "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", - "api_containerimage": "{api.containerImage}" - } - }, + "type": "project.v0", + "path": "../WaitForSandbox.ApiService/WaitForSandbox.ApiService.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{api.bindings.http.targetPort}", - "ConnectionStrings__db": "{db.connectionString}", - "ConnectionStrings__azdb": "{azdb.connectionString}" + "ConnectionStrings__db": "{db.connectionString}" }, "bindings": { "http": { @@ -166,74 +65,15 @@ } } }, - "sqlserver": { - "type": "container.v1", - "connectionString": "Server={sqlserver.bindings.tcp.host},{sqlserver.bindings.tcp.port};User ID=sa;Password={sqlserver-password.value};TrustServerCertificate=true", - "image": "mcr.microsoft.com/mssql/server:2022-latest", - "deployment": { - "type": "azure.bicep.v0", - "path": "sqlserver.module.bicep", - "params": { - "env_outputs_volumes_sqlserver_0": "{env.outputs.volumes_sqlserver_0}", - "sqlserver_password_value": "{sqlserver-password.value}", - "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}" - } - }, - "volumes": [ - { - "name": "sqlserver-data", - "target": "/var/opt/mssql", - "readOnly": false - } - ], - "env": { - "ACCEPT_EULA": "Y", - "MSSQL_SA_PASSWORD": "{sqlserver-password.value}" - }, - "bindings": { - "tcp": { - "scheme": "tcp", - "protocol": "tcp", - "transport": "tcp", - "targetPort": 1433 - } - } - }, - "sqldb": { - "type": "value.v0", - "connectionString": "{sqlserver.connectionString};Initial Catalog=sqldb" - }, "frontend": { - "type": "project.v1", - "path": "../Publishers.Frontend/Publishers.Frontend.csproj", - "deployment": { - "type": "azure.bicep.v0", - "path": "frontend.module.bicep", - "params": { - "frontend_containerport": "{frontend.containerPort}", - "sqlserver_password_value": "{sqlserver-password.value}", - "param0_value": "{param0.value}", - "param1_value": "{param1.value}", - "param2_value": "{param2.value}", - "param3_value": "{param3.value}", - "env_outputs_azure_container_apps_environment_default_domain": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN}", - "env_outputs_azure_container_apps_environment_id": "{env.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}", - "env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}", - "env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}", - "frontend_containerimage": "{frontend.containerImage}" - } - }, + "type": "project.v0", + "path": "../WaitFor.Frontend/WaitFor.Frontend.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", "HTTP_PORTS": "{frontend.bindings.http.targetPort}", - "ConnectionStrings__sqldb": "{sqldb.connectionString}", - "P0": "{param0.value}", - "P1": "{param1.value}", - "P2": "{param2.value}", - "P3": "{param3.value}", "services__api__http__0": "{api.bindings.http.url}", "services__api__https__0": "{api.bindings.https.url}" }, @@ -250,47 +90,32 @@ } } }, - "api-identity": { - "type": "azure.bicep.v0", - "path": "api-identity.module.bicep" - }, - "api-roles-azpg": { - "type": "azure.bicep.v0", - "path": "api-roles-azpg.module.bicep", - "params": { - "azpg_outputs_name": "{azpg.outputs.name}", - "principalId": "{api-identity.outputs.principalId}", - "principalName": "{api-identity.outputs.principalName}" - } - }, - "pg-password": { + "pg-username": { "type": "parameter.v0", - "value": "{pg-password.inputs.value}", + "value": "{pg-username.inputs.value}", "inputs": { "value": { "type": "string", - "secret": true, "default": { "generate": { - "minLength": 22 + "minLength": 10, + "numeric": false, + "special": false } } } } }, - "sqlserver-password": { + "pg-password": { "type": "parameter.v0", - "value": "{sqlserver-password.inputs.value}", + "value": "{pg-password.inputs.value}", "inputs": { "value": { "type": "string", "secret": true, "default": { "generate": { - "minLength": 22, - "minLower": 1, - "minUpper": 1, - "minNumeric": 1 + "minLength": 22 } } } diff --git a/playground/publishers/Publishers.AppHost/pg.module.bicep b/playground/publishers/Publishers.AppHost/pg.module.bicep index 34d363ae27b..56c31a454fd 100644 --- a/playground/publishers/Publishers.AppHost/pg.module.bicep +++ b/playground/publishers/Publishers.AppHost/pg.module.bicep @@ -1,58 +1,75 @@ @description('The location for the resource(s) to be deployed.') param location string = resourceGroup().location +param administratorLogin string + @secure() -param pg_password_value string +param administratorLoginPassword string -param env_outputs_azure_container_apps_environment_id string +param keyVaultName string -resource pg 'Microsoft.App/containerApps@2024-03-01' = { - name: 'pg' +resource pg 'Microsoft.DBforPostgreSQL/flexibleServers@2024-08-01' = { + name: take('pg-${uniqueString(resourceGroup().id)}', 63) location: location properties: { - configuration: { - secrets: [ - { - name: 'postgres-password' - value: pg_password_value - } - ] - activeRevisionsMode: 'Single' - ingress: { - external: false - targetPort: 5432 - transport: 'tcp' - } + administratorLogin: administratorLogin + administratorLoginPassword: administratorLoginPassword + authConfig: { + activeDirectoryAuth: 'Disabled' + passwordAuth: 'Enabled' + } + availabilityZone: '1' + backup: { + backupRetentionDays: 7 + geoRedundantBackup: 'Disabled' } - environmentId: env_outputs_azure_container_apps_environment_id - template: { - containers: [ - { - image: 'docker.io/library/postgres:17.2' - name: 'pg' - env: [ - { - name: 'POSTGRES_HOST_AUTH_METHOD' - value: 'scram-sha-256' - } - { - name: 'POSTGRES_INITDB_ARGS' - value: '--auth-host=scram-sha-256 --auth-local=scram-sha-256' - } - { - name: 'POSTGRES_USER' - value: 'postgres' - } - { - name: 'POSTGRES_PASSWORD' - secretRef: 'postgres-password' - } - ] - } - ] - scale: { - minReplicas: 1 - } + highAvailability: { + mode: 'Disabled' } + storage: { + storageSizeGB: 32 + } + version: '16' + } + sku: { + name: 'Standard_B1ms' + tier: 'Burstable' + } + tags: { + 'aspire-resource-name': 'pg' + } +} + +resource postgreSqlFirewallRule_AllowAllAzureIps 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2024-08-01' = { + name: 'AllowAllAzureIps' + properties: { + endIpAddress: '0.0.0.0' + startIpAddress: '0.0.0.0' + } + parent: pg +} + +resource db 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2024-08-01' = { + name: 'db' + parent: pg +} + +resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = { + name: keyVaultName +} + +resource connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = { + name: 'connectionString' + properties: { + value: 'Host=${pg.properties.fullyQualifiedDomainName};Username=${administratorLogin};Password=${administratorLoginPassword}' + } + parent: keyVault +} + +resource db_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = { + name: 'db-connectionString' + properties: { + value: 'Host=${pg.properties.fullyQualifiedDomainName};Username=${administratorLogin};Password=${administratorLoginPassword};Database=db' } + parent: keyVault } \ No newline at end of file From 347955a265c50e1f1feadfcd9f7135d6697c5364 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 9 May 2025 13:49:22 -0400 Subject: [PATCH 14/14] restore --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 78beafd224d..187dea03856 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -152,7 +152,7 @@ jobs: env: CI: false run: | - ./build.sh -testnobuild && + ./build.sh -restore -testnobuild && for f in `find playground -name '*.AppHost.csproj'`; do echo "Generating manifest for $f"; ./dotnet.sh run --project $f --no-build --publisher manifest --output-path $PWD/$(dirname $f)/aspire-manifest.json; done && git diff --exit-code -- playground