Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-idempotency-field
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs
  • Loading branch information
Fargekritt committed Feb 3, 2025
2 parents 86ecb02 + 8be436e commit cd41fab
Show file tree
Hide file tree
Showing 142 changed files with 3,570 additions and 568 deletions.
12 changes: 12 additions & 0 deletions .azure/applications/graphql/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ param appConfigurationName string
@secure()
param environmentKeyVaultName string

@description('The ratio of traces to sample (between 0.0 and 1.0). Lower values reduce logging volume.')
@minLength(1)
param otelTraceSamplerRatio string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'

Expand Down Expand Up @@ -84,6 +88,14 @@ var containerAppEnvVars = [
name: 'AZURE_CLIENT_ID'
value: managedIdentity.properties.clientId
}
{
name: 'OTEL_TRACES_SAMPLER'
value: 'parentbased_traceidratio'
}
{
name: 'OTEL_TRACES_SAMPLER_ARG'
value: otelTraceSamplerRatio
}
]

var port = 8080
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/graphql/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.54'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/graphql/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.86.131'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/graphql/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.69'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/graphql/yt01.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.85.197'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '0.5'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
12 changes: 12 additions & 0 deletions .azure/applications/service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ param appConfigurationName string
@minLength(3)
param environmentKeyVaultName string

@description('The ratio of traces to sample (between 0.0 and 1.0). Lower values reduce logging volume.')
@minLength(1)
param otelTraceSamplerRatio string

@description('The scaling configuration for the container app')
param scale Scale = {
minReplicas: 2
Expand Down Expand Up @@ -116,6 +120,14 @@ var containerAppEnvVars = [
name: 'Infrastructure__MassTransit__Host'
value: 'sb://${serviceBusNamespaceName}.servicebus.windows.net/'
}
{
name: 'OTEL_TRACES_SAMPLER'
value: 'parentbased_traceidratio'
}
{
name: 'OTEL_TRACES_SAMPLER_ARG'
value: otelTraceSamplerRatio
}
]

resource environmentKeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
Expand Down
3 changes: 3 additions & 0 deletions .azure/applications/service/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')

param otelTraceSamplerRatio = '1'

// secrets
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
2 changes: 2 additions & 0 deletions .azure/applications/service/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NA
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')

param otelTraceSamplerRatio = '1'

// secrets
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
2 changes: 2 additions & 0 deletions .azure/applications/service/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NA
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')

param otelTraceSamplerRatio = '1'

// secrets
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
2 changes: 2 additions & 0 deletions .azure/applications/service/yt01.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NA
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')

param otelTraceSamplerRatio = '0.5'

// secrets
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
12 changes: 12 additions & 0 deletions .azure/applications/web-api-eu/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ param appConfigurationName string
@secure()
param environmentKeyVaultName string

@description('The ratio of traces to sample (between 0.0 and 1.0). Lower values reduce logging volume.')
@minLength(1)
param otelTraceSamplerRatio string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'
var tags = {
Expand Down Expand Up @@ -87,6 +91,14 @@ var containerAppEnvVars = [
name: 'AZURE_CLIENT_ID'
value: managedIdentity.properties.clientId
}
{
name: 'OTEL_TRACES_SAMPLER'
value: 'parentbased_traceidratio'
}
{
name: 'OTEL_TRACES_SAMPLER_ARG'
value: otelTraceSamplerRatio
}
]

@description('The scaling configuration for the container app')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-eu/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.54'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-eu/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.86.131'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-eu/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.69'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-eu/yt01.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.85.197'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '0.5'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
12 changes: 12 additions & 0 deletions .azure/applications/web-api-so/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ param appConfigurationName string
@secure()
param environmentKeyVaultName string

@description('The ratio of traces to sample (between 0.0 and 1.0). Lower values reduce logging volume.')
@minLength(1)
param otelTraceSamplerRatio string

@description('The scaling configuration for the container app')
param scale Scale = {
minReplicas: 2
Expand Down Expand Up @@ -115,6 +119,14 @@ var containerAppEnvVars = [
name: 'AZURE_CLIENT_ID'
value: managedIdentity.properties.clientId
}
{
name: 'OTEL_TRACES_SAMPLER'
value: 'parentbased_traceidratio'
}
{
name: 'OTEL_TRACES_SAMPLER_ARG'
value: otelTraceSamplerRatio
}
]

resource environmentKeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.54'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.86.131'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.120.88.69'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '1'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/yt01.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ param apimIp = '51.13.85.197'
param imageTag = readEnvironmentVariable('IMAGE_TAG')
param revisionSuffix = readEnvironmentVariable('REVISION_SUFFIX')

param otelTraceSamplerRatio = '0.5'

// secrets
param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/azure-login/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
description: 'Azure Subscription ID'
required: true
env:
AZ_CLI_VERSION: 2.67.0
AZ_CLI_VERSION: 2.68.0
runs:
using: "composite"
steps:
Expand All @@ -25,4 +25,4 @@ runs:

- name: Upgrade Azure Bicep
shell: bash
run: az bicep upgrade
run: az bicep upgrade
10 changes: 0 additions & 10 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ permissions:
id-token: write

jobs:
release-please:
name: Release please
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_PAT }}
release-type: simple

generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/workflow-generate-git-short-sha.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
store-apps-version:
name: Store Latest Deployed Apps Version as GitHub Variable
needs: [deploy-apps, get-current-version]
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.deploy-apps.outputs.deployment_executed == 'true') }}
if: ${{ always() && !failure() && (github.event_name == 'workflow_dispatch' || needs.deploy-apps.outputs.deployment_executed == 'true') }}
uses: ./.github/workflows/workflow-store-github-env-variable.yml
with:
variable_name: LATEST_DEPLOYED_APPS_VERSION
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/ci-cd-release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# This workflow runs on every push to main and:
# 1. Checks if a new release should be created (via release-please)
# 2. If a release is created:
# 2.1. Checks for backend changes since previous release
# 2.2. If backend changes exist, builds and publishes Docker images with the new version
# 2.3. Triggers staging and yt01 deployment via repository dispatch

name: CI/CD Release Please

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write
packages: write

jobs:
release-please:
name: Release please
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
previous_release_sha: ${{ steps.get-previous-release.outputs.sha }}
steps:
- name: Get previous release SHA
id: get-previous-release
run: |
sha=$(gh api repos/${{ github.repository }}/releases/latest --jq '.target_commitish')
echo "sha=${sha}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_PAT }}

check-for-changes:
name: Check for changes
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created == 'true' }}
uses: ./.github/workflows/workflow-check-for-changes.yml
with:
apps_base_sha: ${{ needs.release-please.outputs.previous_release_sha }}

publish:
name: Build and publish docker images
needs: [release-please, check-for-changes]
if: needs.release-please.outputs.release_created == 'true' && needs.check-for-changes.outputs.hasBackendChanges == 'true'
uses: ./.github/workflows/workflow-publish.yml
secrets:
GCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
dockerImageBaseName: ghcr.io/altinn/dialogporten-
version: ${{ needs.release-please.outputs.version }}

notify-release-created:
name: Notify release created
needs: [release-please, publish]
if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Notify release created
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.RELEASE_PLEASE_PAT }}
event-type: release_created
client-payload: '{"version": "${{ needs.release-please.outputs.version }}"}'

send-slack-message-on-failure:
name: Send Slack message on failure
needs: [release-please, publish, notify-release-created]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
environment: release-please
publish_status: ${{ needs.publish.result }}
release_please_status: ${{ needs.release-please.result }}
notify_release_created_status: ${{ needs.notify-release-created.result }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_FOR_CI_CD_STATUS }}

Loading

0 comments on commit cd41fab

Please sign in to comment.