-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
218 lines (194 loc) · 5.54 KB
/
azure-pipelines.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
trigger:
branches:
include:
- master
resources:
repositories:
- repository: self
type: git
variables:
appName: check-your-czech
experimentalSlotName: exp
adminEmail: '[email protected]'
subscription: Visual Studio Enterprise Subscription (a7b6f428-0ed2-4721-9548-d17c361d9b77)
stages:
- stage: Build
jobs:
- job: Job1
displayName: 'Build, Test, Publish'
pool:
vmImage: 'windows-2019'
steps:
- task: DotNetCoreCLI@2
displayName: Restore tools
inputs:
command: custom
custom: tool
arguments: restore
- task: DotNetCoreCLI@2
displayName: Restore backend packages
inputs:
command: custom
custom: paket
arguments: restore
- task: Yarn@2
displayName: Restore frontend packages
inputs:
arguments: 'install --frozen-lockfile'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: custom
custom: fsi
arguments: 'build.fsx'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
arguments: '--filter FullyQualifiedName!~Client.UiTests'
- task: DotNetCoreCLI@2
displayName: Publish Server
inputs:
command: publish
publishWebProjects: false
projects: 'src/Server'
arguments: '-c release -o deploy -r win-x64'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: Publish Client
inputs:
sourceFolder: 'src/Client/public'
targetFolder: 'deploy/public'
- task: DotNetCoreCLI@2
displayName: Publish Scraper
inputs:
command: publish
publishWebProjects: false
projects: 'src/Scraper'
arguments: '-c release -o deploy/app_data/Jobs/Continuous/Scraper -r win-x64'
zipAfterPublish: false
modifyOutputPath: false
- task: ArchiveFiles@2
displayName: Zip app
inputs:
rootFolderOrFile: deploy
includeRootFolder: false
archiveFile: 'deploy.zip'
- publish: 'deploy.zip'
artifact: WebApp
- stage: Release
dependsOn: Build
jobs:
- job: Job1
displayName: Create resources
pool:
vmImage: 'windows-2019'
steps:
- download: current
artifact: WebApp
- task: DotNetCoreCLI@2
displayName: Restore tools
inputs:
command: custom
custom: tool
arguments: restore
- task: DotNetCoreCLI@2
displayName: Restore backend packages
inputs:
command: custom
custom: paket
arguments: restore
- task: DotNetCoreCLI@2
displayName: Generate ARM template from Farmer
inputs:
command: run
arguments: $(appName)
workingDirectory: 'deployment/Deployment'
- task: AzureResourceGroupDeployment@2
displayName: Create Application Insights
inputs:
azureSubscription: $(subscription)
resourceGroupName: $(appName)
location: North Europe
csmFile: 'arm-template.json'
overrideParameters: '-appName $(appName) -adminEmail $(adminEmail)'
deploymentName: $(appName)
- task: AzureResourceGroupDeployment@2
displayName: Create other Azure resources
inputs:
azureSubscription: $(subscription)
resourceGroupName: $(appName)
location: North Europe
csmFile: 'deployment/Deployment/template.json'
deploymentName: $(appName)
- task: AzureCLI@1
displayName: Create experimental slot
inputs:
azureSubscription: $(subscription)
scriptLocation: inlineScript
inlineScript: 'az webapp deployment slot create -n $(appName) -g $(appName) -s $(experimentalSlotName)'
- deployment: Job2
displayName: Deploy to Experimental
dependsOn: Job1
pool:
vmImage: 'windows-2019'
environment: Experimental
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: Deploy app
inputs:
azureSubscription: $(subscription)
appType: webApp
appName: $(appName)
deployToSlotOrASE: true
resourceGroupName: $(appName)
slotName: $(experimentalSlotName)
package: '$(Pipeline.Workspace)/WebApp/deploy.zip'
deploymentMethod: zipDeploy
- job: Job3
displayName: Test Experimental deployment
dependsOn: Job2
pool:
vmImage: 'windows-2019'
steps:
- task: DotNetCoreCLI@2
displayName: Restore tools
inputs:
command: custom
custom: tool
arguments: restore
- task: DotNetCoreCLI@2
displayName: Restore backend packages
inputs:
command: custom
custom: paket
arguments: restore
- task: DotNetCoreCLI@2
displayName: Run E2E tests
inputs:
command: test
arguments: '--filter FullyQualifiedName~Client.UiTests'
env:
SERVER_URL: 'https://$(appName)-$(experimentalSlotName).azurewebsites.net/'
- deployment: Job4
displayName: Deploy to Production
dependsOn: Job3
pool:
vmImage: 'windows-2019'
environment: Production
strategy:
runOnce:
deploy:
steps:
- task: AzureAppServiceManage@0
displayName: Swap slots
inputs:
azureSubscription: $(subscription)
action: Swap Slots
webAppName: $(appName)
resourceGroupName: $(appName)
sourceSlot: $(experimentalSlotName)