Skip to content

Commit

Permalink
Merge branch 'main' into chore/graphql-opentelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad authored Nov 5, 2024
2 parents aab39ec + 9d7defe commit b731535
Show file tree
Hide file tree
Showing 213 changed files with 7,911 additions and 4,570 deletions.
2 changes: 1 addition & 1 deletion .azure/modules/postgreSql/create.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module privateDnsZone '../privateDnsZone/main.bicep' = {
}
}

resource postgres 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
resource postgres 'Microsoft.DBforPostgreSQL/flexibleServers@2024-08-01' = {
name: postgresServerName
location: location
properties: {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
deploy-infra:
name: Deploy infra to test
needs: [get-current-version, check-for-changes, generate-git-short-sha]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
41 changes: 38 additions & 3 deletions .github/workflows/ci-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,29 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}

jobs:
# Get changed files between previous tag and current tag: https://github.com/marketplace/actions/changed-files
get-versions-from-github:
name: Get Latest Deployed Version Info from GitHub
uses: ./.github/workflows/workflow-get-latest-deployed-version-info-from-github.yml
with:
environment: prod
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-for-changes:
name: Check for changes
needs: [get-versions-from-github]
uses: ./.github/workflows/workflow-check-for-changes.yml
with:
infra_base_sha: ${{ needs.get-versions-from-github.outputs.infra_version_sha }}
apps_base_sha: ${{ needs.get-versions-from-github.outputs.apps_version_sha }}

get-current-version:
name: Get current version
uses: ./.github/workflows/workflow-get-current-version.yml

dry-run-deploy-infra:
name: Dry run deploy infra to prod
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
needs: [get-current-version, check-for-changes]
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
Expand All @@ -40,7 +51,7 @@ jobs:

deploy-infra:
name: Deploy infra to prod
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
needs: [get-current-version, check-for-changes, dry-run-deploy-infra]
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
Expand All @@ -56,6 +67,18 @@ jobs:
region: norwayeast
version: ${{ needs.get-current-version.outputs.version }}

store-infra-version:
name: Store Latest Deployed Infra Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-infra, get-current-version]
if: ${{ needs.deploy-infra.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed infra version
run: |
gh variable set LATEST_DEPLOYED_INFRA_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env prod --repo ${{ github.repository }}
dry-run-deploy-apps:
name: Dry run deploy apps to prod
needs:
Expand Down Expand Up @@ -104,6 +127,18 @@ jobs:
version: ${{ needs.get-current-version.outputs.version }}
runMigration: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}

store-apps-version:
name: Store Latest Deployed Apps Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-apps, get-current-version]
if: ${{ needs.deploy-apps.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed apps version
run: |
gh variable set LATEST_DEPLOYED_APPS_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env prod --repo ${{ github.repository }}
deploy-slack-notifier:
name: Deploy slack notifier (prod)
needs: [check-for-changes]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
build-infrastructure:
uses: ./.github/workflows/workflow-build-infrastructure.yml
needs: [check-for-changes]
if: ${{ always() && needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ always() && needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -46,7 +46,7 @@ jobs:
get-current-version,
build-infrastructure,
]
if: ${{ always() && needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ always() && needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
63 changes: 48 additions & 15 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}

jobs:
# Get changed files between previous tag and current tag: https://github.com/marketplace/actions/changed-files
get-versions-from-github:
name: Get Latest Deployed Version Info from GitHub
uses: ./.github/workflows/workflow-get-latest-deployed-version-info-from-github.yml
with:
environment: staging
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-for-changes:
name: Check for changes
needs: [get-versions-from-github]
uses: ./.github/workflows/workflow-check-for-changes.yml
with:
infra_base_sha: ${{ needs.get-versions-from-github.outputs.infra_version_sha }}
apps_base_sha: ${{ needs.get-versions-from-github.outputs.apps_version_sha }}

get-current-version:
name: Get current version
uses: ./.github/workflows/workflow-get-current-version.yml

publish:
name: Build and publish docker images
uses: ./.github/workflows/workflow-publish.yml
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' }}
needs: [get-current-version, check-for-changes]
secrets:
GCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
dockerImageBaseName: ghcr.io/digdir/dialogporten-
version: ${{ needs.get-current-version.outputs.version }}

deploy-infra:
name: Deploy infra to staging
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
needs: [get-current-version, check-for-changes]
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
Expand All @@ -48,18 +48,39 @@ jobs:
region: norwayeast
version: ${{ needs.get-current-version.outputs.version }}

store-infra-version:
name: Store Latest Deployed Infra Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-infra, get-current-version]
if: ${{ needs.deploy-infra.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed infra version
run: |
gh variable set LATEST_DEPLOYED_INFRA_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env staging --repo ${{ github.repository }}
publish:
name: Build and publish docker images
uses: ./.github/workflows/workflow-publish.yml
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' }}
needs: [get-current-version, check-for-changes]
secrets:
GCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
dockerImageBaseName: ghcr.io/digdir/dialogporten-
version: ${{ needs.get-current-version.outputs.version }}

deploy-apps:
name: Deploy apps to staging
needs:
[get-current-version, check-for-changes, deploy-infra, publish]
# we want deployment of apps to be dependent on deployment of infrastructure, but if infrastructure is skipped, we still want to deploy the apps
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') }}
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# todo: consider resolving these in another way since they are created in the infra-step
AZURE_RESOURCE_GROUP_NAME: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }}
AZURE_CONTAINER_APP_ENVIRONMENT_NAME: ${{ secrets.AZURE_CONTAINER_APP_ENVIRONMENT_NAME }}
Expand All @@ -72,6 +93,18 @@ jobs:
version: ${{ needs.get-current-version.outputs.version }}
runMigration: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}

store-apps-version:
name: Store Latest Deployed Apps Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-apps, get-current-version]
if: ${{ needs.deploy-apps.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed apps version
run: |
gh variable set LATEST_DEPLOYED_APPS_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env staging
deploy-slack-notifier:
name: Deploy slack notifier (staging)
needs: [check-for-changes]
Expand Down
39 changes: 37 additions & 2 deletions .github/workflows/ci-cd-yt01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}

jobs:
# Get changed files between previous tag and current tag: https://github.com/marketplace/actions/changed-files
get-versions-from-github:
name: Get Latest Deployed Version Info from GitHub
uses: ./.github/workflows/workflow-get-latest-deployed-version-info-from-github.yml
with:
environment: yt01
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-for-changes:
name: Check for changes
needs: [get-versions-from-github]
uses: ./.github/workflows/workflow-check-for-changes.yml
with:
infra_base_sha: ${{ needs.get-versions-from-github.outputs.infra_version_sha }}
apps_base_sha: ${{ needs.get-versions-from-github.outputs.apps_version_sha }}

get-current-version:
name: Get current version
Expand All @@ -32,7 +43,7 @@ jobs:

deploy-infra:
name: Deploy infra to yt01
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasAzureChanges == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
needs: [get-current-version, check-for-changes]
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
Expand All @@ -48,6 +59,18 @@ jobs:
region: norwayeast
version: ${{ needs.get-current-version.outputs.version }}

store-infra-version:
name: Store Latest Deployed Infra Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-infra, get-current-version]
if: ${{ needs.deploy-infra.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed infra version
run: |
gh variable set LATEST_DEPLOYED_INFRA_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env yt01 --repo ${{ github.repository }}
deploy-apps:
name: Deploy apps to yt01
needs:
Expand All @@ -72,6 +95,18 @@ jobs:
version: ${{ needs.get-current-version.outputs.version }}
runMigration: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}

store-apps-version:
name: Store Latest Deployed Apps Version as GitHub Variable
runs-on: ubuntu-latest
needs: [deploy-apps, get-current-version]
if: ${{ needs.deploy-apps.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set GitHub variable for latest deployed apps version
run: |
gh variable set LATEST_DEPLOYED_APPS_VERSION --body "${{ needs.get-current-version.outputs.version }}" --env yt01 --repo ${{ github.repository }}
deploy-slack-notifier:
name: Deploy slack notifier (yt01)
needs: [check-for-changes]
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/dispatch-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ inputs.environment }}

jobs:

generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/workflow-generate-git-short-sha.yml
Expand All @@ -35,16 +36,11 @@ jobs:
name: Get current version
uses: ./.github/workflows/workflow-get-current-version.yml

check-for-changes:
name: Check for changes
uses: ./.github/workflows/workflow-check-for-changes.yml

deploy-apps:
name: Deploy apps to ${{ inputs.environment }}
needs:
- generate-git-short-sha
- get-current-version
- check-for-changes
uses: ./.github/workflows/workflow-deploy-apps.yml
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/dispatch-k6-performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run K6 performance test

on:
workflow_dispatch:
inputs:
apiVersion:
description: 'API Version'
required: true
default: 'v1'
environment:
description: 'Environment'
required: true
default: 'staging'
type: choice
options:
- test
- staging
- performance
tokens:
description: 'Tokens to generate; for create dialog, search, none, or both'
required: true
default: 'both'
type: choice
options:
- both
- enterprise
- personal
- none
vus:
description: 'Number of VUS'
required: true
default: 10
type: number
duration:
description: 'Duration of test, ie 30s, 1m, 10m'
required: true
default: 1m
type: string
testSuitePath:
description: 'Path to test suite to run'
required: true
default: 'tests/k6/tests/serviceowner/performance/create-dialog.js'
type: choice
options:
- 'tests/k6/tests/serviceowner/performance/create-dialog.js'
- 'tests/k6/tests/enduser/performance/simple-search.js'

jobs:
k6-performance:
name: "Run K6 performance test"
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 }}
with:
environment: ${{ inputs.environment }}
apiVersion: ${{ inputs.apiVersion }}
testSuitePath: ${{ inputs.testSuitePath }}
vus: ${{ fromJson(inputs.vus) }}
duration: ${{ inputs.duration }}
tokens: ${{ inputs.tokens }}

Loading

0 comments on commit b731535

Please sign in to comment.