-
Notifications
You must be signed in to change notification settings - Fork 30
243 lines (241 loc) · 9.95 KB
/
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
name: E2E Tests
on:
push:
branches: ["main", "release-**", "feature/*"]
pull_request:
branches: ["main", "feature/*"]
paths:
- "tests/**"
- "pkg/**"
- "cmd/**"
- "charts/**"
- ".github/workflows/**"
- "Dockerfile"
# This workflow runs e2e tests and relies on existance of EKS cluster with a `s3-csi-driver-sa` service account
# already deployed to it, which provides the driver with access to s3.
#
# Since we have a single cluster for e2e tests, we ensure that no more than one instance of this workflow is
# running by `concurrency: e2e-cluster` option.
#
# Succesfull workflows triggered by push to main will upload tested image to the private repository "PROMOTED_IMAGE_NAME":
# - uploaded images will be tagged with main branch commit number
# - uploaded images will be later promoted to public repository by "release" workflow
concurrency: e2e-cluster
env:
AWS_REGION: "us-east-1"
COMMIT_ID: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
TMP_IMAGE_NAME: "s3-csi-driver-tmp"
PROMOTED_IMAGE_NAME: "s3-csi-driver"
BENCHMARK_RESULTS_BUCKET: "s3://mountpoint-s3-csi-driver-benchmark"
BENCHMARK_RESULTS_REGION: "us-east-1"
BENCHMARK_ARTIFACTS_FOLDER: ".github/artifacts"
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build:
# this is to prevent the job to run at forked projects
if: github.repository == 'awslabs/mountpoint-s3-csi-driver'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: ${{ secrets.TEST_IAM_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push docker image to Amazon ECR Private Repository
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_NAME: ${{ env.TMP_IMAGE_NAME }}
run: |
export PLATFORM=linux/amd64,linux/arm64
export TAG=${{ env.COMMIT_ID }}
make -j `nproc` all-push
test:
needs: build
strategy:
# Failing fast causes some resources created during the test to leak,
# so we disable it to ensure all resources created during test are properly cleaned up.
fail-fast: false
matrix:
cluster-type: ["eksctl", "kops"]
arch: ["x86", "arm"]
family: ["AmazonLinux2", "Bottlerocket"]
kubernetes-version: ["1.28.13", "1.29.8", "1.30.4", "1.31.0"]
exclude:
- cluster-type: "kops"
family: "Bottlerocket"
- cluster-type: "eksctl"
arch: "arm"
family: "Bottlerocket"
# Our tests are failing on clusters created with kops 1.29+.
# Until we fix that issue, we use kops 1.28 which only supports k8s versions up to 1.28.
# So, we only run our tests in k8s versions 1.29 and 1.30 on eksctl.
- cluster-type: "kops"
kubernetes-version: "1.29.8"
- cluster-type: "kops"
kubernetes-version: "1.30.4"
- cluster-type: "kops"
kubernetes-version: "1.31.0"
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: ${{ secrets.TEST_IAM_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Install tools
run: |
export ACTION=install_tools
tests/e2e-kubernetes/scripts/run.sh
- name: Create cluster
run: |
export ACTION=create_cluster
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Update kubeconfig
run: |
export ACTION=update_kubeconfig
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Install the driver
run: |
export ACTION=install_driver
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export IMAGE_NAME=${{ env.TMP_IMAGE_NAME }}
export TAG=${{ env.COMMIT_ID }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Run E2E Tests
run: |
export ACTION=run_tests
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export TAG=${{ env.COMMIT_ID }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Run Performance Tests
if: (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'bench') && matrix.cluster-type == 'kops' && matrix.arch == 'x86'
run: |
export ACTION=run_perf
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export TAG=${{ env.COMMIT_ID }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Download previous benchmark results
if: (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'bench') && matrix.cluster-type == 'kops' && matrix.arch == 'x86'
run: |
mkdir -p ${{ env.BENCHMARK_ARTIFACTS_FOLDER }}
aws s3 cp --region ${{ env.BENCHMARK_RESULTS_REGION }} ${{ env.BENCHMARK_RESULTS_BUCKET }}/benchmark-data.json ${{ env.BENCHMARK_ARTIFACTS_FOLDER }}/benchmark-data.json || true
- name: Update benchmark result file
if: (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'bench') && matrix.cluster-type == 'kops' && matrix.arch == 'x86'
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "customBiggerIsBetter"
output-file-path: tests/e2e-kubernetes/csi-test-artifacts/output.json
alert-threshold: "200%"
fail-on-alert: true
external-data-json-path: ${{ env.BENCHMARK_ARTIFACTS_FOLDER }}/benchmark-data.json
max-items-in-chart: 20
- name: Store benchmark result
if: (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'bench') && matrix.cluster-type == 'kops' && matrix.arch == 'x86'
run: |
tests/e2e-kubernetes/scripts/format_benchmark_data.py ${{ env.BENCHMARK_ARTIFACTS_FOLDER }}/benchmark-data.json ${{ env.BENCHMARK_ARTIFACTS_FOLDER }}/quicksight-data.json
aws s3 cp ${{ env.BENCHMARK_ARTIFACTS_FOLDER }} s3://mountpoint-s3-csi-driver-benchmark --recursive
- name: Post e2e cleanup
if: always()
run: |
export ACTION=e2e_cleanup
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Uninstall the driver
if: always()
run: |
export ACTION=uninstall_driver
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
- name: Delete cluster
if: always()
run: |
export ACTION=delete_cluster
export AWS_REGION=${{ env.AWS_REGION }}
export CLUSTER_TYPE=${{ matrix.cluster-type }}
export ARCH=${{ matrix.arch }}
export AMI_FAMILY=${{ matrix.family }}
export K8S_VERSION=${{ matrix.kubernetes-version }}
tests/e2e-kubernetes/scripts/run.sh
promote:
if: startsWith(github.ref_name, 'release')
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Set up crane
uses: imjasonh/setup-crane@v0.1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: ${{ secrets.TEST_IAM_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Promote image for release branch
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
export TMP_IMAGE_NAME=${REGISTRY}/${{ env.TMP_IMAGE_NAME }}:${{ env.COMMIT_ID }}
export NEW_IMAGE_NAME=${REGISTRY}/${{ env.PROMOTED_IMAGE_NAME }}:${{ env.COMMIT_ID }}
crane copy ${TMP_IMAGE_NAME} ${NEW_IMAGE_NAME}