-
Notifications
You must be signed in to change notification settings - Fork 1
340 lines (306 loc) · 13.1 KB
/
shared-run-e2e-tests.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
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
name: Run Operator E2E Tests
on:
workflow_call:
inputs:
operator_root:
description: The root path for uid2-operator folder
type: string
default: uid2-operator
core_root:
description: The root path for uid2-core folder
type: string
default: uid2-core
optout_root:
description: The root path for uid2-optout folder
type: string
default: uid2-optout
admin_root:
description: The root path for uid2-admin folder
type: string
default: uid2-admin
operator_image_version:
description: 'Image: Operator image version'
type: string
default: latest
core_image_version:
description: 'Image: Core image version'
type: string
default: latest
optout_image_version:
description: 'Image: Optout image version'
type: string
default: latest
e2e_image_version:
description: 'Image: E2E image version'
type: string
default: latest
operator_branch:
description: 'Config: Operator branch for config'
type: string
default: main
branch_core:
description: 'Config: Core branch for config'
type: string
default: main
branch_optout:
description: 'Config: Optout branch for config'
type: string
default: main
branch_admin:
description: 'Config: Admin branch for config'
type: string
default: main
operator_type:
description: The operator type [public, gcp, azure, aws]
type: string
default: public
uid2_e2e_identity_scope:
description: Environment variable to run the E2E test for identity scope [UID2, EUID]
required: false
type: string
default: UID2
uid2_e2e_phone_support:
description: Environment variable to run the E2E test for phone support [true, false]
required: false
type: string
default: 'true'
gcp_project:
description: The name of the GCP project
type: string
gcp_service_account:
description: The GCP service account
type: string
gcp_workload_identity_provider_id:
description: The GCP workload identity provider ID
type: string
aws_region:
description: The AWS region [us-east-1, us-west-1, ca-central-1, eu-central-1]
type: string
aws_ami:
description: The AWS AMI ID
type: string
aws_pcr0:
description: The AWS PCR0
type: string
eks_pcr0:
description: The EKS PCR0
type: string
eks_test_cluster:
description: The EKS Test Cluster Name
type: string
eks_test_cluster_region:
description: The EKS Test Cluster Region
type: string
env:
REGISTRY: ghcr.io
jobs:
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
id-token: write
steps:
- name: Log in to the Docker container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Checkout full history
uses: actions/checkout@v4
- name: Checkout uid2-operator repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.operator_branch }}
repository: IABTechLab/uid2-operator
path: uid2-operator
- name: Checkout uid2-core repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_core }}
repository: IABTechLab/uid2-core
path: uid2-core
- name: Checkout uid2-optout repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_optout }}
repository: IABTechLab/uid2-optout
path: uid2-optout
- name: Checkout uid2-admin repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_admin }}
repository: IABTechLab/uid2-admin
path: uid2-admin
- name: Checkout uid2-shared-actions repo
uses: actions/checkout@v4
with:
ref: v3
repository: IABTechLab/uid2-shared-actions
path: uid2-shared-actions
- name: Checkout uid2-e2e repo
uses: actions/checkout@v4
with:
repository: IABTechLab/uid2-e2e
path: uid2-e2e
- name: Create Docker network
run: |
docker network create e2e_default
- name: Bring up bore
id: bore
if: ${{ inputs.operator_type == 'gcp' || inputs.operator_type == 'azure' || inputs.operator_type == 'aws' || inputs.operator_type == 'eks'}}
run: |
bash uid2-shared-actions/scripts/setup_bore.sh
- name: Prepare GCP metadata
id: prepare_gcp_metadata
if: ${{ inputs.operator_type == 'gcp' }}
uses: IABTechLab/uid2-shared-actions/actions/prepare_gcp_metadata@v2
with:
operator_image_version: ${{ inputs.operator_image_version }}
admin_root: ${{ inputs.admin_root }}
gcp_service_account: ${{ inputs.gcp_service_account }}
gcp_workload_identity_provider_id: ${{ inputs.gcp_workload_identity_provider_id }}
- name: Prepare Azure metadata
id: prepare_azure_metadata
if: ${{ inputs.operator_type == 'azure' }}
uses: IABTechLab/uid2-shared-actions/actions/prepare_azure_metadata@v2
with:
operator_image_version: ${{ inputs.operator_image_version }}
admin_root: ${{ inputs.admin_root }}
- name: Prepare AWS metadata
id: prepare_aws_metadata
if: ${{ inputs.operator_type == 'aws' }}
uses: IABTechLab/uid2-shared-actions/actions/prepare_aws_metadata@v3
with:
admin_root: ${{ inputs.admin_root }}
aws_pcr0: ${{ inputs.aws_pcr0 }}
- name: Prepare EKS metadata
id: prepare_eks_metadata
if: ${{ inputs.operator_type == 'eks' }}
uses: IABTechLab/uid2-shared-actions/actions/prepare_eks_metadata@v3
with:
operator_image_version: ${{ inputs.operator_image_version }}
admin_root: ${{ inputs.admin_root }}
eks_pcr0: ${{ inputs.eks_pcr0 }}
- name: Bring up Docker Compose
id: docker-compose
env:
OPERATOR_ROOT: ${{ inputs.operator_root }}
CORE_ROOT: ${{ inputs.core_root }}
OPTOUT_ROOT: ${{ inputs.optout_root }}
ADMIN_ROOT: ${{ inputs.admin_root }}
OPERATOR_VERSION: ${{ inputs.operator_image_version }}
CORE_VERSION: ${{ inputs.core_image_version }}
OPTOUT_VERSION: ${{ inputs.optout_image_version }}
E2E_VERSION: ${{ inputs.e2e_image_version }}
OPERATOR_TYPE: ${{ inputs.operator_type }}
BORE_URL_CORE: ${{ steps.bore.outputs.BORE_URL_CORE }}
BORE_URL_OPTOUT: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
BORE_URL_LOCALSTACK: ${{ steps.bore.outputs.BORE_URL_LOCALSTACK }}
run: |
bash uid2-shared-actions/scripts/prepare_resources_for_e2e_docker_compose.sh
- name: Start GCP private operator
id: start_gcp_private_operator
if: ${{ inputs.operator_type == 'gcp' }}
uses: IABTechLab/uid2-shared-actions/actions/start_gcp_private_operator@v2
with:
bore_url_core: ${{ steps.bore.outputs.BORE_URL_CORE }}
bore_url_optout: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
gcp_project: ${{ inputs.gcp_project }}
gcp_service_account: ${{ inputs.gcp_service_account }}
image_hash: ${{ steps.prepare_gcp_metadata.outputs.image_hash }}
operator_key: ${{ steps.prepare_gcp_metadata.outputs.operator_key }}
- name: Start Azure private operator
id: start_azure_private_operator
if: ${{ inputs.operator_type == 'azure' }}
uses: IABTechLab/uid2-shared-actions/actions/start_azure_private_operator@v2
with:
bore_url_core: ${{ steps.bore.outputs.BORE_URL_CORE }}
bore_url_optout: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
output_template_file: ${{ steps.prepare_azure_metadata.outputs.output_template_file }}
output_parameters_file: ${{ steps.prepare_azure_metadata.outputs.output_parameters_file }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
- name: Start AWS private operator
id: start_aws_private_operator
if: ${{ inputs.operator_type == 'aws' }}
uses: IABTechLab/uid2-shared-actions/actions/start_aws_private_operator@v3
with:
bore_url_core: ${{ steps.bore.outputs.BORE_URL_CORE }}
bore_url_optout: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
bore_url_localstack: ${{ steps.bore.outputs.BORE_URL_LOCALSTACK }}
aws_region: ${{ inputs.aws_region }}
aws_ami: ${{ inputs.aws_ami }}
identity_scope: ${{ inputs.uid2_e2e_identity_scope }}
operator_key: ${{ steps.prepare_aws_metadata.outputs.operator_key }}
- name: Start EKS operator
id: start_EKS_operator
if: ${{ inputs.operator_type == 'eks' }}
uses: IABTechLab/uid2-shared-actions/actions/start_eks_operator@v3
with:
bore_url_core: ${{ steps.bore.outputs.BORE_URL_CORE }}
bore_url_optout: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
bore_url_localstack: ${{ steps.bore.outputs.BORE_URL_LOCALSTACK }}
identity_scope: ${{ inputs.uid2_e2e_identity_scope }}
operator_image_version: ${{ inputs.operator_image_version }}
operator_root: ${{ inputs.operator_root }}
operator_key: ${{ steps.prepare_eks_metadata.outputs.operator_key }}
eks_test_cluster: ${{ inputs.eks_test_cluster }}
eks_test_cluster_region: ${{ inputs.eks_test_cluster_region }}
- name: Decide E2E test environment variables
id: decide_env_var
shell: bash
env:
OPERATOR_TYPE: ${{ inputs.operator_type }}
OPERATOR_URL: ${{ steps.start_gcp_private_operator.outputs.uid2_e2e_pipeline_operator_url }}
IDENTITY_SCOPE: ${{ inputs.uid2_e2e_identity_scope }}
BORE_URL_CORE: ${{ steps.bore.outputs.BORE_URL_CORE }}
BORE_URL_OPTOUT: ${{ steps.bore.outputs.BORE_URL_OPTOUT }}
GCP_OPERATOR_URL: ${{ steps.start_gcp_private_operator.outputs.uid2_e2e_pipeline_operator_url }}
AZURE_OPERATOR_URL: ${{ steps.start_azure_private_operator.outputs.uid2_e2e_pipeline_operator_url }}
AWS_OPERATOR_URL: ${{ steps.start_aws_private_operator.outputs.uid2_e2e_pipeline_operator_url }}
EKS_OPERATOR_URL: ${{ steps.start_EKS_operator.outputs.uid2_e2e_pipeline_operator_url }}
run: |
bash uid2-shared-actions/scripts/decide_e2e_env.sh
- name: Run E2E tests
id: e2e
uses: IABTechLab/uid2-shared-actions/actions/run_e2e_tests@v3
with:
e2e_network: ${{ steps.decide_env_var.outputs.e2e_network }}
e2e_image_version: ${{ inputs.e2e_image_version }}
uid2_e2e_identity_scope: ${{ inputs.uid2_e2e_identity_scope }}
uid2_e2e_pipeline_operator_url: ${{ steps.decide_env_var.outputs.uid2_e2e_pipeline_operator_url }}
uid2_e2e_pipeline_operator_type: ${{ steps.decide_env_var.outputs.uid2_e2e_pipeline_operator_type }}
uid2_e2e_pipeline_operator_cloud_provider: ${{ steps.decide_env_var.outputs.uid2_e2e_pipeline_operator_cloud_provider }}
uid2_e2e_phone_support: ${{ steps.decide_env_var.outputs.uid2_e2e_phone_support }}
uid2_e2e_pipeline_core_url: ${{ steps.decide_env_var.outputs.uid2_e2e_pipeline_core_url }}
uid2_e2e_pipeline_optout_url: ${{ steps.decide_env_var.outputs.uid2_e2e_pipeline_optout_url }}
- name: Stop GCP private operator
if: ${{ inputs.operator_type == 'gcp' }}
env:
GCP_PROJECT: ${{ inputs.gcp_project }}
SERVICE_ACCOUNT: ${{ inputs.gcp_service_account }}
GCP_INSTANCE_NAME: ${{ steps.start_gcp_private_operator.outputs.gcp_instance_name }}
run: |
bash uid2-shared-actions/scripts/gcp/stop_gcp_enclave.sh
- name: Stop Azure private operator
if: ${{ inputs.operator_type == 'azure' }}
env:
AZURE_CONTAINER_GROUP_NAME: ${{ steps.start_azure_private_operator.outputs.azure_container_group_name }}
run: |
bash uid2-shared-actions/scripts/azure/stop_azure_enclave.sh
- name: Stop AWS private operator
if: ${{ inputs.operator_type == 'aws' }}
env:
AWS_STACK_NAME: ${{ steps.start_aws_private_operator.outputs.aws_stack_name }}
AWS_REGION: ${{ inputs.aws_region }}
run: |
bash uid2-shared-actions/scripts/aws/stop_aws_enclave.sh
- name: Stop EKS operator
if: ${{ inputs.operator_type == 'eks' }}
uses: IABTechLab/uid2-shared-actions/actions/stop_eks_operator@v3
with:
eks_test_cluster: ${{ inputs.eks_test_cluster }}
eks_test_cluster_region: ${{ inputs.eks_test_cluster_region }}
identity_scope: ${{ inputs.uid2_e2e_identity_scope }}