-
Notifications
You must be signed in to change notification settings - Fork 287
173 lines (162 loc) · 5.99 KB
/
e2e.yaml
File metadata and controls
173 lines (162 loc) · 5.99 KB
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
name: E2E
on:
workflow_call:
inputs:
image_tag:
required: true
type: string
description: The image tag to use for the E2E tests.
image_registry:
required: true
type: string
description: The image registry to use for the E2E tests.
image_namespace:
required: true
type: string
description: The image namespace to use for the E2E tests.
azure_location:
required: true
type: string
description: The Azure location to use for the E2E tests.
azure_agent_linux_sku:
required: false
default: ''
type: string
description: VM SKU for the Linux agent pool. Falls back to the in-code default when empty.
azure_agent_windows_sku:
required: false
default: ''
type: string
description: VM SKU for the Windows agent pool. Falls back to the in-code default when empty.
azure_agent_linux_arm_sku:
required: false
default: ''
type: string
description: VM SKU for the ARM64 agent pool. Falls back to the in-code default when empty.
use_existing_infra:
required: false
default: false
type: boolean
description: Whether to use existing infrastructure for the E2E tests.
cluster_name:
required: false
type: string
description: The name of the cluster to use for the E2E tests.
resource_group:
required: false
type: string
description: The name of the resource group to use for the E2E tests.
secrets:
AZURE_CLIENT_ID:
required: true
description: The Azure client ID for authentication.
AZURE_TENANT_ID:
required: true
description: The Azure tenant ID for authentication.
AZURE_SUBSCRIPTION:
required: true
description: The Azure subscription ID for authentication.
workflow_dispatch:
inputs:
image_tag:
required: true
type: string
description: The image tag to use for the E2E tests.
image_registry:
required: true
type: string
description: The image registry to use for the E2E tests.
image_namespace:
required: true
type: string
description: The image namespace to use for the E2E tests.
azure_location:
required: false
type: string
description: The Azure location to use for the E2E tests.
azure_agent_linux_sku:
required: false
default: ''
type: string
description: VM SKU for the Linux agent pool. Falls back to the in-code default when empty.
azure_agent_windows_sku:
required: false
default: ''
type: string
description: VM SKU for the Windows agent pool. Falls back to the in-code default when empty.
azure_agent_linux_arm_sku:
required: false
default: ''
type: string
description: VM SKU for the ARM64 agent pool. Falls back to the in-code default when empty.
use_existing_infra:
required: false
default: false
type: boolean
description: Whether to use existing infrastructure for the E2E tests.
cluster_name:
required: false
type: string
description: The name of the cluster to use for the E2E tests. Cluster should be in MS Corp Tenant and Test Subscription
resource_group:
required: false
type: string
description: The name of the resource group to use for the E2E tests. Resource Group should be in MS Corp Tenant and Test Subscription
permissions:
contents: read
id-token: write
jobs:
e2e:
name: E2E
runs-on: ubuntu-latest
timeout-minutes: 120
env:
CLUSTER_NAME: retina-e2e-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- run: go version
- name: Az CLI login
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Run E2E
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
AZURE_LOCATION: ${{ inputs.azure_location }}
AZURE_AGENT_LINUX_SKU: ${{ inputs.azure_agent_linux_sku }}
AZURE_AGENT_WINDOWS_SKU: ${{ inputs.azure_agent_windows_sku }}
AZURE_AGENT_LINUX_ARM_SKU: ${{ inputs.azure_agent_linux_arm_sku }}
IMAGE_TAG: ${{ inputs.image_tag }}
IMAGE_REGISTRY: ${{ inputs.image_registry }}
IMAGE_NAMESPACE: ${{ inputs.image_namespace }}
USE_EXISTING_INFRA: ${{ inputs.use_existing_infra }}
INPUT_CLUSTER_NAME: ${{ inputs.cluster_name }}
INPUT_RESOURCE_GROUP: ${{ inputs.resource_group }}
shell: bash
run: |
set -euo pipefail
if [ "$USE_EXISTING_INFRA" = "true" ]; then
export CLUSTER_NAME="$INPUT_CLUSTER_NAME"
export AZURE_RESOURCE_GROUP="$INPUT_RESOURCE_GROUP"
CREATE_INFRA=false
DELETE_INFRA=false
else
CREATE_INFRA=true
DELETE_INFRA=true
fi
go test -v ./test/e2e/. -timeout 60m -tags=e2e -count=1 -args -image-tag="$IMAGE_TAG" -image-registry="$IMAGE_REGISTRY" -image-namespace="$IMAGE_NAMESPACE" -create-infra="$CREATE_INFRA" -delete-infra="$DELETE_INFRA"
- name: Cleanup resource group
if: always()
shell: bash
run: |
if az group exists --name "$CLUSTER_NAME" 2>/dev/null | grep -q true; then
echo "Deleting resource group $CLUSTER_NAME..."
az group delete --name "$CLUSTER_NAME" --yes --no-wait || true
fi