-
Notifications
You must be signed in to change notification settings - Fork 9
/
azure-pipelines.yml
371 lines (355 loc) · 14.1 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
trigger:
- main
stages:
- stage: Pull_Request
condition: ne(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job: CI
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: |
# TODO: Workaround for duplicate aesm service
# Remove here once https://github.com/occlum/occlum/pull/443 merged.
docker-compose up -d
docker-compose exec -T sgx_machine bash -c "sudo chown -R anonify-dev:anonify-dev anonify ; cd anonify && ./scripts/test.sh"
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run rust-sgx-sdk tests'
- script: docker-compose down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'rust-sgx-sdk docker-compose down'
- job: PGX_CI
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: |
docker-compose -f pgx-docker-compose.yml up -d
docker-compose -f pgx-docker-compose.yml exec -T sgx_machine_pgx bash -c "cd anonify && ./scripts/encrypted-sql-ops-pg-test.sh"
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run encrypted-sql-ops-pg integration tests'
- script: docker-compose -f pgx-docker-compose.yml down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'pgx docker-compose down'
- job: E2E_CI
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: Build erc20 image
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: erc20-state-runtime
tags: latest
dockerfile: ./docker/example-erc20.Dockerfile
buildContext: .
arguments: '--build-arg AZ_KV_ENDPOINT=$(AZ_KV_ENDPOINT) --build-arg AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) --build-arg AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) --build-arg AZURE_TENANT_ID=$(AZURE_TENANT_ID) --build-arg PROD_ID=$(PROD_ID) --build-arg ISVSVN=$(ISVSVN)'
- task: Docker@2
displayName: Build key-vault for erc20 image
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: key-vault-for-erc20
tags: latest
dockerfile: ./docker/example-keyvault.Dockerfile
buildContext: .
arguments: '--build-arg AZ_KV_ENDPOINT=$(AZ_KV_ENDPOINT) --build-arg AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) --build-arg AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) --build-arg AZURE_TENANT_ID=$(AZURE_TENANT_ID) --build-arg PROD_ID=$(PROD_ID) --build-arg ISVSVN=$(ISVSVN)'
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: ./scripts/e2e-test.sh
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run E2E tests'
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images'
- script: docker-compose -f e2e-docker-compose.yml down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'Shutdown'
# NOTE: temporary removed: Add once occlum version bump up to 0.23.0
# - job: OCCLUM_CI
# - template: templates/setup_env.yml
# - script: |
# docker-compose -f occlum-docker-compose.yml up -d
# # TODO: Remove the dettached mode flag once the enclave runs as the embedded mode.
# docker-compose -f occlum-docker-compose.yml exec -d -T enclave bash -c "./anonify/scripts/occlum-enclave-test.sh"
# docker-compose -f occlum-docker-compose.yml exec -T host bash -c "./anonify/scripts/occlum-host-test.sh"
# displayName: 'Run occlum tests'
# env:
# SPID: $(SPID)
# SUB_KEY: $(SUB_KEY)
# - script: |
# sudo systemctl restart aesmd
# LD_LIBRARY_PATH=/opt/intel/sgx-aesm-service/aesm /opt/intel/sgx-aesm-service/aesm/aesm_service
# docker-compose -f occlum-docker-compose.yml down --rmi all --volumes --remove-orphans
# condition: always()
# displayName: 'occlum docker-compose down'
- stage: Merge_to_main_for_base
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job: CheckChangesOfBaseDockerfile
displayName: 'Check changes of base Dockerfile'
steps:
- template: templates/check_changes_of_base_dockerfile.yml
- job: Build_and_Push_rust_sgx_sdk_rootless_image
pool:
name: 'AnonifyAgent'
dependsOn: CheckChangesOfBaseDockerfile
condition: eq(dependencies.CheckChangesOfBaseDockerfile.outputs['check_changes_of_base_dockerfile.SOURCE_CODE_CHANGED'], 'true')
steps:
- task: Docker@2
displayName: 'Build rust-sgx-sdk-rootless image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: rust-sgx-sdk-rootless
tags: latest
dockerfile: ./docker/base-rust-sgx-sdk-rootless.Dockerfile
buildContext: .
- task: Docker@2
displayName: 'Push rust-sgx-sdk-rootless image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: rust-sgx-sdk-rootless
tags: latest
dockerfile: ./docker/base-rust-sgx-sdk-rootless.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for rootless'
- script: docker rmi anonify.azurecr.io/rust-sgx-sdk-rootless:latest
condition: always()
displayName: 'Remove built images for rootless'
- job: Build_and_Push_anonify_dev_image
pool:
name: 'AnonifyAgent'
dependsOn: CheckChangesOfBaseDockerfile
condition: eq(dependencies.CheckChangesOfBaseDockerfile.outputs['check_changes_of_base_dockerfile.SOURCE_CODE_CHANGED'], 'true')
steps:
- task: Docker@2
displayName: 'Build anonify-dev image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: anonify-dev
tags: latest
dockerfile: ./docker/base-anonify-dev.Dockerfile
buildContext: .
- task: Docker@2
displayName: 'Push anonify-dev image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: anonify-dev
tags: latest
dockerfile: ./docker/base-anonify-dev.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for base'
- script: docker rmi anonify.azurecr.io/anonify-dev:latest
condition: always()
displayName: 'Remove built images for base'
- job: Build_and_Push_anonify_dev_pgx_image
pool:
name: 'AnonifyAgent'
dependsOn: CheckChangesOfBaseDockerfile
condition: eq(dependencies.CheckChangesOfBaseDockerfile.outputs['check_changes_of_base_dockerfile.SOURCE_CODE_CHANGED'], 'true')
steps:
- task: Docker@2
displayName: 'Build anonify-dev-pgx image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: anonify-dev-pgx
tags: latest
dockerfile: ./docker/base-anonify-dev-pgx.Dockerfile
buildContext: .
- task: Docker@2
displayName: 'Push anonify-dev-pgx image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: anonify-dev-pgx
tags: latest
dockerfile: ./docker/base-anonify-dev-pgx.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for pgx'
- script: docker rmi anonify.azurecr.io/anonify-dev-pgx:latest
condition: always()
displayName: 'Remove built images for pgx'
- stage: Merge_to_main_base_for_example
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job: CI
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: |
# TODO: Workaround for duplicate aesm service
# Remove here once https://github.com/occlum/occlum/pull/443 merged.
docker-compose up -d
docker-compose exec -T sgx_machine bash -c "sudo chown -R anonify-dev:anonify-dev anonify ; cd anonify && ./scripts/test.sh"
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run rust-sgx-sdk tests'
- script: docker-compose down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'rust-sgx-sdk docker-compose down'
- job: Build_and_Push_erc20_image
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Build erc20 image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: erc20-state-runtime
tags: latest
dockerfile: ./docker/example-erc20.Dockerfile
buildContext: .
arguments: '--build-arg AZ_KV_ENDPOINT=$(AZ_KV_ENDPOINT) --build-arg AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) --build-arg AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) --build-arg AZURE_TENANT_ID=$(AZURE_TENANT_ID) --build-arg PROD_ID=$(PROD_ID) --build-arg ISVSVN=$(ISVSVN)'
- task: Docker@2
displayName: 'Push erc20 image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: erc20-state-runtime
tags: latest
dockerfile: ./docker/example-erc20.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for state-runtime-erc20'
- script: docker rmi anonify.azurecr.io/erc20-state-runtime:latest
condition: always()
displayName: 'Remove built images for state-runtime-rc20'
- job: Build_and_Push_key_vault_for_erc20_image
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Build key-vault for erc20 image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: key-vault-for-erc20
tags: latest
dockerfile: ./docker/example-keyvault.Dockerfile
buildContext: .
arguments: '--build-arg AZ_KV_ENDPOINT=$(AZ_KV_ENDPOINT) --build-arg AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) --build-arg AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) --build-arg AZURE_TENANT_ID=$(AZURE_TENANT_ID) --build-arg PROD_ID=$(PROD_ID) --build-arg ISVSVN=$(ISVSVN)'
- task: Docker@2
displayName: 'Push key-vault for erc20 image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: key-vault-for-erc20
tags: latest
dockerfile: ./docker/example-keyvault.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for key-vault-erc20'
- script: docker rmi anonify.azurecr.io/key-vault-for-erc20:latest
condition: always()
displayName: 'Remove built images for key-vault-erc20'
- job: E2E_CI
pool:
name: 'AnonifyAgent'
dependsOn: ['Build_and_Push_erc20_image', 'Build_and_Push_key_vault_for_erc20_image']
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: ./scripts/e2e-test.sh
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run E2E tests'
- script: docker-compose -f e2e-docker-compose.yml down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'Shutdown'
- job: PGX_CI
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: anonify-ci-cd-acr
- template: templates/setup_env.yml
- script: |
docker-compose -f pgx-docker-compose.yml up -d
docker-compose -f pgx-docker-compose.yml exec -T sgx_machine_pgx bash -c "cd anonify && ./scripts/encrypted-sql-ops-pg-test.sh"
env:
SPID: $(SPID)
SUB_KEY: $(SUB_KEY)
displayName: 'Run encrypted-sql-ops-pg integration tests'
- script: docker-compose -f pgx-docker-compose.yml down --rmi all --volumes --remove-orphans
condition: always()
displayName: 'pgx docker-compose down'
- job: Build_and_Push_encrypted_sql_ops_pg_image
pool:
name: 'AnonifyAgent'
steps:
- task: Docker@2
displayName: 'Build encrypted-sql-ops-pg image'
inputs:
command: build
containerRegistry: anonify-ci-cd-acr
repository: encrypted-sql-ops-pg
tags: latest
dockerfile: ./docker/example-encrypted-sql-ops-pg.Dockerfile
buildContext: .
arguments: '--build-arg AZ_KV_ENDPOINT=$(AZ_KV_ENDPOINT) --build-arg AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) --build-arg AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) --build-arg AZURE_TENANT_ID=$(AZURE_TENANT_ID) --build-arg PROD_ID=$(PROD_ID) --build-arg ISVSVN=$(ISVSVN)'
- task: Docker@2
displayName: 'Push encrypted-sql-ops-pg image'
inputs:
command: push
containerRegistry: anonify-ci-cd-acr
repository: encrypted-sql-ops-pg
tags: latest
dockerfile: ./docker/example-encrypted-sql-ops-pg.Dockerfile
buildContext: .
- script: docker image prune -f
condition: always()
displayName: 'Remove dangling images for sql'
- script: docker rmi anonify.azurecr.io/encrypted-sql-ops-pg:latest
condition: always()
displayName: 'Remove built images for sql'