Skip to content

Commit

Permalink
Merge branch 'main' into chore/user-assigned-identity
Browse files Browse the repository at this point in the history
  • Loading branch information
arealmaas committed Dec 20, 2024
2 parents 6a38937 + 25283d2 commit ac89b64
Show file tree
Hide file tree
Showing 69 changed files with 1,798 additions and 208 deletions.
8 changes: 4 additions & 4 deletions .azure/infrastructure/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ param slackNotifierSku = {
}
param postgresConfiguration = {
sku: {
name: 'Standard_B1ms'
tier: 'Burstable'
name: 'Standard_D4ads_v5'
tier: 'GeneralPurpose'
}
storage: {
storageSizeGB: 32
storageSizeGB: 256
autoGrow: 'Enabled'
type: 'Premium_LRS'
}
enableIndexTuning: false
enableIndexTuning: true
enableQueryPerformanceInsight: true
}

Expand Down
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
7 changes: 6 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# 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

# OTEL
OTEL_NAMESPACE=dialogporten-local
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
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
2 changes: 1 addition & 1 deletion .github/slack-templates/pipeline-failed.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Job Status:*\n• Infrastructure: ${{ env.INFRA_STATUS }}\n• Apps: ${{ env.APPS_STATUS }}\n• Slack Notifier: ${{ env.SLACK_NOTIFIER_STATUS }}\n• E2E Tests: ${{ env.E2E_TESTS_STATUS }}\n• Schema NPM: ${{ env.SCHEMA_NPM_STATUS }}\n• Publish: ${{ env.PUBLISH_STATUS }}"
"text": "*Job Status:*\n• Infrastructure: ${{ env.INFRA_STATUS }}\n• Apps: ${{ env.APPS_STATUS }}\n• Slack Notifier: ${{ env.SLACK_NOTIFIER_STATUS }}\n• E2E Tests: ${{ env.E2E_TESTS_STATUS }}\nPerformance Tests: ${{ env.PERFORMANCE_TESTS_STATUS }}\nSchema NPM: ${{ env.SCHEMA_NPM_STATUS }}\n• Publish: ${{ env.PUBLISH_STATUS }}"
}
},
{
Expand Down
42 changes: 38 additions & 4 deletions .github/workflows/ci-cd-yt01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
# push:
# tags:
# - "v*.*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
Expand Down Expand Up @@ -140,9 +140,42 @@ jobs:
checks: write
pull-requests: write

run-performance-tests:
name: "Run K6 performance tests"
# we want the performance tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasInfraChanges == 'true') }}
needs: [deploy-apps, deploy-infra, check-for-changes]
#needs: [deploy-apps, check-for-changes]
uses: ./.github/workflows/workflow-run-k6-performance.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }}

strategy:
max-parallel: 1
matrix:
files:
- tests/k6/tests/serviceowner/serviceOwnerSearchWithThresholds.js
- tests/k6/tests/serviceowner/createDialogWithThresholds.js
- tests/k6/tests/enduser/enduserSearchWithThresholds.js
fail-fast: false
with:
environment: yt01
apiVersion: v1
vus: 1
duration: 30s
tokens: both
numberOfTokens: 100
testSuitePath: ${{ matrix.files }}
permissions:
checks: write
pull-requests: write

send-slack-message-on-failure:
name: Send Slack message on failure
needs: [deploy-infra, deploy-apps, deploy-slack-notifier, run-e2e-tests, publish]
needs: [deploy-infra, deploy-apps, deploy-slack-notifier, run-e2e-tests, publish, run-performance-tests]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
Expand All @@ -151,6 +184,7 @@ jobs:
apps_status: ${{ needs.deploy-apps.result }}
slack_notifier_status: ${{ needs.deploy-slack-notifier.result }}
e2e_tests_status: ${{ needs.run-e2e-tests.result }}
performance_tests_status: ${{ needs.run-performance-tests.result }}
publish_status: ${{ needs.publish.result }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
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
13 changes: 11 additions & 2 deletions .github/workflows/workflow-run-k6-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ on:
tokens:
required: true
type: string
numberOfTokens:
required: false
type: number
default: 0
ttl:
required: false
type: number
default: 3600
secrets:
TOKEN_GENERATOR_USERNAME:
required: true
Expand All @@ -45,9 +53,10 @@ jobs:
uses: grafana/setup-k6-action@v1
- name: Run K6 tests (${{ inputs.testSuitePath }})
run: |
./tests/k6/tests/scripts/generate_tokens.sh ./tests/k6/tests/performancetest_data ${{ inputs.tokens }}
./tests/k6/tests/scripts/generate_tokens.sh ./tests/k6/tests/performancetest_data ${{ inputs.tokens }} ${{ inputs.numberOfTokens }} ${{ inputs.ttl }}
echo "Running k6 test suite ${{ inputs.testSuitePath }} with ${{ inputs.vus }} VUs for ${{ inputs.duration }}"
k6 run ${{ inputs.testSuitePath }} --quiet --log-output=stdout --include-system-env-vars \
--vus=${{ inputs.vus }} --duration=${{ inputs.duration }} --out=cloud --out csv=./results.csv
--vus=${{ inputs.vus }} --duration=${{ inputs.duration }} --out csv=./results.csv
grep http_req_duration ./results.csv | sort --field-separator=',' --key=3 -nr | head -10
env:
API_ENVIRONMENT: ${{ inputs.environment }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
type: string
description: "Status of the end-to-end tests job"
default: "skipped"
performance_tests_status:
type: string
description: "Status of the performance tests job"
default: "skipped"
schema_npm_status:
type: string
description: "Status of the schema npm publishing job"
Expand Down Expand Up @@ -69,6 +73,7 @@ jobs:
echo "SCHEMA_NPM_EMOJI=$(determine_emoji "${{ inputs.schema_npm_status }}")"
echo "PUBLISH_EMOJI=$(determine_emoji "${{ inputs.publish_status }}")"
echo "BUILD_AND_TEST_EMOJI=$(determine_emoji "${{ inputs.build_and_test_status }}")"
echo "PERFORMANCE_TESTS_EMOJI=$(determine_emoji "${{ inputs.performance_tests_status }}")"
} >> "$GITHUB_OUTPUT"
- name: Send GitHub slack message
Expand All @@ -85,6 +90,7 @@ jobs:
SCHEMA_NPM_STATUS: "${{ steps.status-emojis.outputs.SCHEMA_NPM_EMOJI }}"
PUBLISH_STATUS: "${{ steps.status-emojis.outputs.PUBLISH_EMOJI }}"
BUILD_AND_TEST_STATUS: "${{ steps.status-emojis.outputs.BUILD_AND_TEST_EMOJI }}"
PERFORMANCE_TESTS_STATUS: "${{ steps.status-emojis.outputs.PERFORMANCE_TESTS_EMOJI }}"
uses: slackapi/[email protected]
with:
errors: true
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## [1.42.0](https://github.com/digdir/dialogporten/compare/v1.41.3...v1.42.0) (2024-12-16)


### Features

* **apps:** add otel exporter for graphql, service and web-api ([#1528](https://github.com/digdir/dialogporten/issues/1528)) ([cb9238e](https://github.com/digdir/dialogporten/commit/cb9238ef76188b4dde371e08b7ce597645bcd8b7))

## [1.41.3](https://github.com/digdir/dialogporten/compare/v1.41.2...v1.41.3) (2024-12-13)


### Bug Fixes

* **azure:** adjust SKU and storage for staging ([#1601](https://github.com/digdir/dialogporten/issues/1601)) ([3fb9f95](https://github.com/digdir/dialogporten/commit/3fb9f9501b4db97847aa1ebc0b77efe722811f0a))
* Collapse subject resource mappings before building sql query ([#1579](https://github.com/digdir/dialogporten/issues/1579)) ([b39c376](https://github.com/digdir/dialogporten/commit/b39c37662f61361b083d7addc60b26ad4e06fab6))
* **webapi:** Explicit null on non-nullable lists no longer causes 500 INTERNAL SERVER ERROR ([#1602](https://github.com/digdir/dialogporten/issues/1602)) ([2e8b3e6](https://github.com/digdir/dialogporten/commit/2e8b3e6db507efd195245ad829dd7d5a96f272ef))

## [1.41.2](https://github.com/digdir/dialogporten/compare/v1.41.1...v1.41.2) (2024-12-12)


### Bug Fixes

* **webapi:** Set correct swagger return type for transmission list ([#1590](https://github.com/digdir/dialogporten/issues/1590)) ([6e88e0c](https://github.com/digdir/dialogporten/commit/6e88e0c13c089d0f4871be2ee95a7f74fb21a51c))

## [1.41.1](https://github.com/digdir/dialogporten/compare/v1.41.0...v1.41.1) (2024-12-09)


Expand Down
Loading

0 comments on commit ac89b64

Please sign in to comment.