-
Notifications
You must be signed in to change notification settings - Fork 71
117 lines (108 loc) · 4.75 KB
/
deploy-designer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Deploy Designer
on:
push:
branches: [ main ]
paths:
- '.github/workflows/deploy-designer.yaml'
- '.github/workflows/template-docker-push.yaml'
- '.github/workflows/template-flux-config-push.yaml'
- '.github/workflows/template-helm-push.yaml'
- '.github/workflows/template-short-sha.yaml'
- 'backend/**'
- 'frontend/**'
- 'Dockefile'
- 'package.json'
- 'charts/altinn-designer/**'
- 'charts/altinn-designer-config/**'
workflow_dispatch:
inputs:
environments:
description: 'Environments to deploy to. Multiple environments can be specified by separating them with a comma.'
required: false
default: 'dev'
permissions:
id-token: write
contents: read
jobs:
get-short-sha:
uses: ./.github/workflows/template-short-sha.yaml
construct-environments-array:
uses: ./.github/workflows/template-construct-environments.yaml
with:
environments: ${{ github.event.inputs.environments || 'staging,preapproved-prod' }}
determine-tag:
needs: get-short-sha
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Determine tag
id: determine-tag
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "tag=${{ needs.get-short-sha.outputs.short-sha }}" >> $GITHUB_OUTPUT
else
sanitized_branch_name=$(echo "${{ github.ref_name }}" | tr -d '()' | tr '/' '-' | tr '_' '-')
echo "tag=${sanitized_branch_name}-${{ needs.get-short-sha.outputs.short-sha }}" >> $GITHUB_OUTPUT
fi
docker-build-push:
needs: [get-short-sha, determine-tag]
uses: ./.github/workflows/template-docker-push.yaml
with:
tags: ${{ needs.determine-tag.outputs.tag }},latest
registry-name: altinntjenestercontainerregistry.azurecr.io
repository-name: altinn-core
environment: dev # dev environment has push access and doesn't require review
secrets:
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
build-args: DESIGNER_VERSION=${{ needs.determine-tag.outputs.tag }}
db-migrations-docker-build-push:
needs: [get-short-sha, determine-tag]
uses: ./.github/workflows/template-docker-push.yaml
with:
tags: ${{ needs.determine-tag.outputs.tag }},latest
registry-name: altinntjenestercontainerregistry.azurecr.io
repository-name: altinn-designer-db-migrations
context: backend
dockerfile: backend/Migrations.Dockerfile
environment: dev # dev environment has push access and doesn't require review
secrets:
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
helm-push:
needs: [get-short-sha, determine-tag]
uses: ./.github/workflows/template-helm-push.yaml
with:
tag: 0.1.0+${{ needs.determine-tag.outputs.tag }} # Helm version needs to be valid sematic version
chart-name: altinn-designer
registry-name: altinntjenestercontainerregistry.azurecr.io
environment: dev
secrets:
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
flux-config-push:
needs: [construct-environments-array, determine-tag, docker-build-push, db-migrations-docker-build-push, helm-push]
strategy:
matrix:
environment: ${{ fromJSON(needs.construct-environments-array.outputs.environmentsjson) }}
uses: ./.github/workflows/template-flux-config-push.yaml
with:
tag: ${{ needs.determine-tag.outputs.tag }}
registry-name: altinntjenestercontainerregistry.azurecr.io
environment: ${{ matrix.environment }}
artifact-environment: ${{ matrix.environment == 'preapproved-prod' && 'prod' || matrix.environment }}
config-chart-name: altinn-designer-config
artifact-name: altinn-designer
helm-set-arguments: environmentName=${{ matrix.environment == 'preapproved-prod' && 'prod' || matrix.environment }},chartVersion=0.1.0+${{ needs.determine-tag.outputs.tag }},imageTag=${{ needs.determine-tag.outputs.tag }},dbMigrationsTag=${{ needs.determine-tag.outputs.tag }},replicas=${{ matrix.environment == 'dev' && 2 || 1 }}
trace-workflow: true
trace-team-name: 'team-studio'
secrets:
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
trace-connection-string: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}
trace-repo-token: ${{ secrets.GITHUB_TOKEN }}