Skip to content

Commit

Permalink
Merge branch 'performance/threshold-tests' of github.com:digdir/dialo…
Browse files Browse the repository at this point in the history
…gporten into performance/threshold-tests
  • Loading branch information
dagfinno committed Dec 12, 2024
2 parents 4344776 + d07f76c commit e9ac04d
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 35 deletions.
3 changes: 0 additions & 3 deletions .azure/modules/redis/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ module privateDnsZone '../privateDnsZone/main.bicep' = {

module privateDnsZoneGroup '../privateDnsZoneGroup/main.bicep' = {
name: '${namePrefix}-redis-privateDnsZoneGroup'
dependsOn: [
privateDnsZone
]
params: {
name: 'default'
dnsZoneGroupName: 'privatelink-redis-cache-windows-net'
Expand Down
3 changes: 0 additions & 3 deletions .azure/modules/serviceBus/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ module privateDnsZone '../privateDnsZone/main.bicep' = {

module privateDnsZoneGroup '../privateDnsZoneGroup/main.bicep' = {
name: '${namePrefix}-service-bus-privateDnsZoneGroup'
dependsOn: [
privateDnsZone
]
params: {
name: 'default'
dnsZoneGroupName: 'privatelink-servicebus-windows-net'
Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ENV variables for docker-compose
POSTGRES_USER=postgres
POSTGRES_PASSWORD=supersecret
POSTGRES_DB=Dialogporten
POSTGRES_DB=dialogporten
DB_CONNECTION_STRING=Server=dialogporten-postgres;Port=5432;Database=${POSTGRES_DB};User ID=${POSTGRES_USER};Password=${POSTGRES_PASSWORD};

COMPOSE_PROJECT_NAME=digdir
28 changes: 28 additions & 0 deletions .github/actions/azure-login/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Azure Login with Bicep Upgrade'
description: 'Login to Azure and upgrade Bicep CLI'

inputs:
client-id:
description: 'Azure Client ID'
required: true
tenant-id:
description: 'Azure Tenant ID'
required: true
subscription-id:
description: 'Azure Subscription ID'
required: true
env:
AZ_CLI_VERSION: 2.67.0
runs:
using: "composite"
steps:
- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
with:
client-id: ${{ inputs.client-id }}
tenant-id: ${{ inputs.tenant-id }}
subscription-id: ${{ inputs.subscription-id }}

- name: Upgrade Azure Bicep
shell: bash
run: az bicep upgrade
18 changes: 7 additions & 11 deletions .github/workflows/workflow-deploy-apps.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
name: Deploy apps
env:
AZ_CLI_VERSION: 2.67.0
on:
workflow_call:
outputs:
Expand Down Expand Up @@ -67,8 +65,8 @@ jobs:
- name: "Checkout GitHub Action"
uses: actions/checkout@v4

- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
- name: Azure Login
uses: ./.github/actions/azure-login
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -119,7 +117,6 @@ jobs:
uses: azure/CLI@v2
if: ${{!inputs.dryRun}}
with:
azcliversion: ${{ env.AZ_CLI_VERSION }}
inlineScript: |
az containerapp job start -n ${{ steps.deploy.outputs.name }} -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
Expand All @@ -129,7 +126,6 @@ jobs:
id: verify-migration
timeout-minutes: 3
with:
azcliversion: ${{ env.AZ_CLI_VERSION }}
inlineScript: |
./.github/tools/containerAppJobVerifier.sh ${{ steps.deploy.outputs.name }} ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} ${{ inputs.version }}
Expand Down Expand Up @@ -162,12 +158,13 @@ jobs:
- name: "Checkout GitHub Action"
uses: actions/checkout@v4

- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
- name: Azure Login
uses: ./.github/actions/azure-login
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Dryrun Deploy app ${{ matrix.name }}(${{ inputs.environment }})
uses: azure/arm-deploy@v2
if: ${{ inputs.dryRun }}
Expand Down Expand Up @@ -223,7 +220,6 @@ jobs:
id: verify-deployment
timeout-minutes: 3
with:
azcliversion: ${{ env.AZ_CLI_VERSION }}
inlineScript: |
./.github/tools/revisionVerifier.sh ${{ steps.deploy.outputs.revisionName }} ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
Expand Down Expand Up @@ -252,8 +248,8 @@ jobs:
- name: "Checkout GitHub Action"
uses: actions/checkout@v4

- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
- name: Azure Login
uses: ./.github/actions/azure-login
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/workflow-deploy-infra.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
name: Deploy infrastructure

env:
AZ_CLI_VERSION: 2.67.0

on:
workflow_call:
secrets:
Expand Down Expand Up @@ -63,8 +59,8 @@ jobs:
with:
ref: ${{ inputs.ref }}

- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
- name: Azure Login
uses: ./.github/actions/azure-login
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -74,7 +70,6 @@ jobs:
uses: azure/CLI@v2
id: keyvault-keys
with:
azcliversion: ${{ env.AZ_CLI_VERSION }}
inlineScript: |
KEY_VAULT_KEYS=$(az keyvault secret list --vault-name ${{ secrets.AZURE_SOURCE_KEY_VAULT_NAME }} --subscription ${{ secrets.AZURE_SOURCE_KEY_VAULT_SUBSCRIPTION_ID }} --query "[].name" -o json | tr -d '\n')
echo "::set-output name=key-vault-keys::$KEY_VAULT_KEYS"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include:

services:
dialogporten-webapi-ingress:
image: nginx:1.27.2
image: nginx:1.27.3
ports:
- "7214:80"
volumes:
Expand Down Expand Up @@ -38,7 +38,7 @@ services:
- ./.aspnet/https:/https

dialogporten-graphql-ingress:
image: nginx:1.27.2
image: nginx:1.27.3
ports:
- "7215:80"
volumes:
Expand Down
16 changes: 14 additions & 2 deletions docs/schema/V1/swagger.verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -4683,7 +4683,7 @@
"JWTBearerAuth": {
"bearerFormat": "JWT",
"description": "Enter a JWT token to authorize the requests...",
"scheme": "Bearer",
"scheme": "bearer",
"type": "http"
}
}
Expand Down Expand Up @@ -5853,6 +5853,9 @@
},
"description": "The UUID of the created the dialog aggregate. A relative URL to the newly created activity is set in the \u0022Location\u0022 header."
},
"204": {
"description": "No Content"
},
"400": {
"content": {
"application/problem\u002Bjson": {
Expand Down Expand Up @@ -6468,6 +6471,9 @@
},
"description": "The UUID of the created the dialog activity. A relative URL to the newly created activity is set in the \u0022Location\u0022 header."
},
"204": {
"description": "No Content"
},
"400": {
"content": {
"application/problem\u002Bjson": {
Expand Down Expand Up @@ -6741,7 +6747,10 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/V1ServiceOwnerDialogTransmissionsQueriesSearch_Transmission"
"items": {
"$ref": "#/components/schemas/V1ServiceOwnerDialogTransmissionsQueriesSearch_Transmission"
},
"type": "array"
}
}
},
Expand Down Expand Up @@ -6825,6 +6834,9 @@
},
"description": "The UUID of the created the dialog transmission. A relative URL to the newly created activity is set in the \u0022Location\u0022 header."
},
"204": {
"description": "No Content"
},
"400": {
"content": {
"application/problem\u002Bjson": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="FastEndpoints.Swagger" Version="5.31.0"/>
<PackageReference Include="FastEndpoints.Swagger" Version="5.32.0"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void Configure()
Policies(AuthorizationPolicy.ServiceProvider);
Group<ServiceOwnerGroup>();

Description(b => b.ProducesOneOf<TransmissionDto>(
Description(b => b.ProducesOneOf<List<TransmissionDto>>(
StatusCodes.Status200OK,
StatusCodes.Status404NotFound,
StatusCodes.Status410Gone));
Expand Down
18 changes: 18 additions & 0 deletions src/Digdir.Domain.Dialogporten.WebApi/OpenApiDocumentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ namespace Digdir.Domain.Dialogporten.WebApi;

public static class OpenApiDocumentExtensions
{
/// <summary>
/// To have this be validated in BlackDuck, we need to lower case the bearer scheme name.
/// From editor.swagger.io:
/// Structural error at components.securitySchemes.JWTBearerAuth
/// should NOT have a `bearerFormat` property without `scheme: bearer` being set
/// </summary>
/// <param name="openApiDocument"></param>
public static void FixJwtBearerCasing(this OpenApiDocument openApiDocument)
{
foreach (var securityScheme in openApiDocument.Components.SecuritySchemes.Values)
{
if (securityScheme.Scheme.Equals("Bearer", StringComparison.Ordinal))
{
securityScheme.Scheme = "bearer";
}
}
}

/// <summary>
/// When generating ProblemDetails and ProblemDetails_Error, there is a bug/weird behavior in NSwag or FastEndpoints
/// which results in certain 'Description' properties being generated when running on f.ex. MacOS,
Expand Down
1 change: 1 addition & 0 deletions src/Digdir.Domain.Dialogporten.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static void BuildAndRun(string[] args, TelemetryConfiguration telemetryConfigura
document.Generator = null;
document.ReplaceProblemDetailsDescriptions();
document.MakeCollectionsNullable();
document.FixJwtBearerCasing();
};
}, uiConfig =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0"/>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.0"/>
<PackageReference Include="NSec.Cryptography" Version="24.4.0"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="System.Formats.Asn1" Version="9.0.0" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="NSubstitute" Version="5.3.0"/>
<PackageReference Include="Respawn" Version="6.2.1"/>
<PackageReference Include="Testcontainers.PostgreSql" Version="4.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Verify.Xunit" Version="28.4.0" />
<PackageReference Include="NSubstitute" Version="5.3.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Medo.Uuid7" Version="2.1.1" />
<PackageReference Include="Microsoft.Build" Version="17.12.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
Expand Down

0 comments on commit e9ac04d

Please sign in to comment.