-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (151 loc) · 7.99 KB
/
__app-deploy.yml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: __Application Deployment
on:
workflow_call:
inputs:
docker-image-tag:
required: true
type: string
docker-registry:
required: true
type: string
environment-name:
required: true
type: string
git-tag:
required: true
type: string
jobs:
run:
runs-on: ubuntu-latest
concurrency: deploy_${{ inputs.environment-name }}
environment: ${{ inputs.environment-name }}
steps:
- uses: actions/checkout@v4 # need to checkout (again) so that our custom action and deployment script is available
- name: Download release artifacts
uses: dsaltares/fetch-gh-release-asset@aa2ab1243d6e0d5b405b973c89fa4d06a2d0fff7 # <- 1.1.2
with:
version: 'tags/${{ inputs.git-tag }}'
file: release.tar.gz
target: obj/release.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract release artifacts
run: mkdir ./out && tar -xvf ./obj/release.tar.gz -C $_
- name: Azure login
uses: ./.github/actions/azure-login
with:
github-environment: ${{ inputs.environment-name }}
- uses: ./.github/actions/export-convention-vars
with:
environment-name: ${{ inputs.environment-name }}
- uses: ./.github/actions/export-infra-vars
with:
environment-name: ${{ inputs.environment-name }}
- uses: kanga333/variable-mapper@3681b75f5c6c00162721168fb91ab74925eaebcb # <- v0.3.0
name: Map variables
with:
mode: fill
key: "${{ inputs.environment-name }}"
map: |
{
"dev": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcome-release-internal.redmz.mrisoftware.com"
},
"qa": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcome-release-internal.redmz.mrisoftware.com"
},
"demo": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcomeci-demo.saas.mrisoftware.com"
},
"staging": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcome-ci.preprod.saas.mrisoftware.com/"
},
"prod-na": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcome-ci.saas.mrisoftware.com"
},
"prod-emea": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://welcomeemea-ci.saas.mrisoftware.com"
},
"prod-apac": {
"Api_TokenProvider_Authority": "https://mrisaas.oktapreview.com/oauth2/default",
"CentralIdentity_BaseUri": "https://apacwelcome-ci.saas.mrisoftware.com"
},
".*": {
"ApplicationInsights_AutoCollectActionArgs": "${{ env.Convention_IsTestEnv }}",
"gha_step_deploy_api_envVarsSelector": "Api_*,ApplicationInsights_*,CentralIdentity_*,EnvironmentInfo_*",
"gha_step_deploy_api_imageToDeploy": "${{ inputs.docker-registry }}/${{ env.Convention_SubProducts_Api_ImageName }}:${{ inputs.docker-image-tag }}",
"gha_step_deploy_app_envVarsSelector": "App_*,ApplicationInsights_*",
"gha_step_deploy_app_imageToDeploy": "${{ inputs.docker-registry }}/${{ env.Convention_SubProducts_App_ImageName }}:${{ inputs.docker-image-tag }}",
"EnvironmentInfo_EnvId": "${{ inputs.environment-name }}",
"EnvironmentInfo_InfraVersion": "${{ env.Infra_Version }}",
"InternalApi_Database_DataSource": "${{ env.Convention_SubProducts_Sql_Primary_DataSource }}",
"InternalApi_Database_InitialCatalog": "${{ env.Convention_SubProducts_Db_ResourceName }}",
"InternalApi_Database_UserID": "${{ env.Infra_InternalApi_ManagedIdentityClientId }}",
"InternalApi_DefaultAzureCredentials_ManagedIdentityClientId": "${{ env.Infra_InternalApi_ManagedIdentityClientId }}",
"InternalApi_KeyVaultName": "${{ env.Convention_SubProducts_KeyVault_ResourceName }}",
"InternalApi_ReportBlobStorage_ServiceUri": "https://${{ env.Convention_SubProducts_PbiReportStorage_StorageAccountName }}.blob.core.windows.net"
}
}
- name: Azure Function App (internalapi) - File substitution in appsettings
uses: joshlrogers/variable-substitution@602057bea9ec150e2142bbae25ed9a64da175569 # <- v1.1.5
with:
files: ./out/Template.Functions/appsettings.json
splitChar: '_'
- name: Deploy SQL database migration
uses: ./.github/actions/sql-action # <- replace with: MRI-Software/sql-action@v1
with:
database-name: ${{ env.Convention_SubProducts_Db_ResourceName }}
server-name: ${{ env.Convention_SubProducts_Sql_Primary_ResourceName }}
sql-file: ./out/migrate-db.sql
- name: Deploy API (primary region)
uses: christianacca/container-apps-revision-action@v1
with:
containerAppName: ${{ env.Convention_SubProducts_Api_Primary_ResourceName }}
envVarsSelector: ${{ env.gha_step_deploy_api_envVarsSelector }}
envVarKeyTransform: _=>__
healthRequestPath: ${{ env.Convention_SubProducts_Api_DefaultHealthPath }}
imageToDeploy: ${{ env.gha_step_deploy_api_imageToDeploy }}
resourceGroup: ${{ env.Convention_AppResourceGroup_ResourceName }}
testRevision: true
- name: Deploy API (failover region)
if: ${{ env.Convention_SubProducts_Api_Failover_ResourceName != null }}
uses: christianacca/container-apps-revision-action@v1
with:
containerAppName: ${{ env.Convention_SubProducts_Api_Failover_ResourceName }}
envVarsSelector: ${{ env.gha_step_deploy_api_envVarsSelector }}
envVarKeyTransform: _=>__
healthRequestPath: ${{ env.Convention_SubProducts_Api_DefaultHealthPath }}
imageToDeploy: ${{ env.gha_step_deploy_api_imageToDeploy }}
resourceGroup: ${{ env.Convention_AppResourceGroup_ResourceName }}
testRevision: true
- name: Deploy App (primary region)
uses: christianacca/container-apps-revision-action@v1
with:
containerAppName: ${{ env.Convention_SubProducts_App_Primary_ResourceName }}
envVarsSelector: ${{ env.gha_step_deploy_app_envVarsSelector }}
envVarKeyTransform: _=>__
healthRequestPath: ${{ env.Convention_SubProducts_App_DefaultHealthPath }}
imageToDeploy: ${{ env.gha_step_deploy_app_imageToDeploy }}
resourceGroup: ${{ env.Convention_AppResourceGroup_ResourceName }}
testRevision: true
- name: Deploy App (failover region)
if: ${{ env.Convention_SubProducts_App_Failover_ResourceName != null }}
uses: christianacca/container-apps-revision-action@v1
with:
containerAppName: ${{ env.Convention_SubProducts_App_Failover_ResourceName }}
envVarsSelector: ${{ env.gha_step_deploy_app_envVarsSelector }}
envVarKeyTransform: _=>__
healthRequestPath: ${{ env.Convention_SubProducts_App_DefaultHealthPath }}
imageToDeploy: ${{ env.gha_step_deploy_app_imageToDeploy }}
resourceGroup: ${{ env.Convention_AppResourceGroup_ResourceName }}
testRevision: true
- name: Azure Function App (internalapi) - Deploy
uses: Azure/functions-action@v1
with:
app-name: ${{ env.Convention_SubProducts_InternalApi_ResourceName }}
package: ./out/Template.Functions