-
Notifications
You must be signed in to change notification settings - Fork 122
358 lines (311 loc) · 12.2 KB
/
run-e2e-on-pr-commits.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
name: E2E
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
paths-ignore:
- '**.md'
- '**.yml'
- '**.yaml'
jobs:
# Helm_Install_Generic_Tests:
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v2
# with:
# ref: ${{ github.event.pull_request.head.sha }}
# - name: Generate go binary and build docker image
# run: make build-amd64
# #Install and configure a kind cluster
# - name: Installing KinD cluster for the test
# uses: engineerd/[email protected]
# with:
# version: "v0.7.0"
# config: "build/kind-cluster/kind-config.yaml"
# - name: Configuring and testing the Installation
# run: |
# kubectl taint nodes kind-control-plane node-role.kubernetes.io/master-
# kind get kubeconfig --internal >$HOME/.kube/config
# kubectl cluster-info --context kind-kind
# kubectl get nodes
# - name: Load docker image
# run: /usr/local/bin/kind load docker-image litmuschaos/go-runner:ci
# - name: Deploy a sample application for chaos injection
# run: |
# kubectl apply -f https://raw.githubusercontent.com/litmuschaos/chaos-ci-lib/master/app/nginx.yml
# kubectl wait --for=condition=Ready pods --all --namespace default --timeout=90s
# - name: Setting up kubeconfig ENV for Github Chaos Action
# run: echo ::set-env name=KUBE_CONFIG_DATA::$(base64 -w 0 ~/.kube/config)
# env:
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true
# - name: Setup Litmus
# uses: litmuschaos/github-chaos-actions@master
# env:
# INSTALL_LITMUS: true
# - name: Running Litmus pod delete chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-delete
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# - name: Running container kill chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: container-kill
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# CONTAINER_RUNTIME: containerd
# - name: Running node-cpu-hog chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: node-cpu-hog
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# - name: Running node-memory-hog chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: node-memory-hog
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# - name: Running pod-cpu-hog chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-cpu-hog
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# CPU_CORES: 1
# - name: Running pod-memory-hog chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-memory-hog
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# MEMORY_CONSUMPTION: 500
# - name: Running pod network corruption chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-network-corruption
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# NETWORK_INTERFACE: eth0
# CONTAINER_RUNTIME: containerd
# - name: Running pod network duplication chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-network-duplication
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# NETWORK_INTERFACE: eth0
# CONTAINER_RUNTIME: containerd
# - name: Running pod-network-latency chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-network-latency
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# NETWORK_INTERFACE: eth0
# NETWORK_LATENCY: 60000
# CONTAINER_RUNTIME: containerd
# - name: Running pod-network-loss chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-network-loss
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TARGET_CONTAINER: nginx
# TOTAL_CHAOS_DURATION: 60
# NETWORK_INTERFACE: eth0
# NETWORK_PACKET_LOSS_PERCENTAGE: 100
# CONTAINER_RUNTIME: containerd
# - name: Running pod autoscaler chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: pod-autoscaler
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TOTAL_CHAOS_DURATION: 60
# - name: Running node-io-stress chaos experiment
# if: always()
# uses: litmuschaos/github-chaos-actions@master
# env:
# EXPERIMENT_NAME: node-io-stress
# EXPERIMENT_IMAGE: litmuschaos/go-runner
# EXPERIMENT_IMAGE_TAG: ci
# IMAGE_PULL_POLICY: IfNotPresent
# JOB_CLEANUP_POLICY: delete
# TOTAL_CHAOS_DURATION: 120
# FILESYSTEM_UTILIZATION_PERCENTAGE: 10
# - name: Uninstall Litmus
# uses: litmuschaos/github-chaos-actions@master
# env:
# LITMUS_CLEANUP: true
# - name: Deleting KinD cluster
# if: always()
# run: kind delete cluster
Pod_Level_In_Serial_Mode:
runs-on: ubuntu-latest
steps:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Generating Go binary and Building docker image
run: |
make build-amd64
#Install and configure a kind cluster
- name: Installing Prerequisites (K3S Cluster)
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.11+k3s1 sh -s - --docker --write-kubeconfig-mode 664
kubectl wait node --all --for condition=ready --timeout=90s
kubectl get nodes
- uses: actions/checkout@v2
with:
repository: 'litmuschaos/litmus-e2e'
ref: 'master'
- name: Running Pod level experiment with affected percentage 100 and in series mode
env:
GO_EXPERIMENT_IMAGE: litmuschaos/go-runner:ci
EXPERIMENT_IMAGE_PULL_POLICY: IfNotPresent
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
make build-litmus
make app-deploy
make pod-affected-perc-ton-series
- name: Deleting K3S cluster
if: always()
run: /usr/local/bin/k3s-uninstall.sh
Pod_Level_In_Parallel_Mode:
runs-on: ubuntu-latest
steps:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Generating Go binary and Building docker image
run: |
make build-amd64
#Install and configure a kind cluster
- name: Installing Prerequisites (K3S Cluster)
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.11+k3s1 sh -s - --docker --write-kubeconfig-mode 664
kubectl wait node --all --for condition=ready --timeout=90s
kubectl get nodes
- uses: actions/checkout@v2
with:
repository: 'litmuschaos/litmus-e2e'
ref: 'master'
- name: Running Pod level experiment with affected percentage 100 and in parallel mode
env:
GO_EXPERIMENT_IMAGE: litmuschaos/go-runner:ci
EXPERIMENT_IMAGE_PULL_POLICY: IfNotPresent
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
make build-litmus
make app-deploy
make pod-affected-perc-ton-parallel
- name: Deleting K3S cluster
if: always()
run: /usr/local/bin/k3s-uninstall.sh
Node_Level_Tests:
runs-on: ubuntu-latest
steps:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Generating Go binary and Building docker image
run: |
make build-amd64
- name: Create KinD Cluster
run: kind create cluster --config build/kind-cluster/kind-config.yaml
- name: Configuring and testing the Installation
run: |
kubectl taint nodes kind-control-plane node-role.kubernetes.io/control-plane-
kubectl cluster-info --context kind-kind
kubectl wait node --all --for condition=ready --timeout=90s
kubectl get nodes
- name: Load image on the nodes of the cluster
run: |
kind load docker-image --name=kind litmuschaos/go-runner:ci
- uses: actions/checkout@v2
with:
repository: 'litmuschaos/litmus-e2e'
ref: 'master'
- name: Setup litmus and deploy application
env:
KUBECONFIG: /home/runner/.kube/config
run: |
make build-litmus
make app-deploy
- name: Running Node Drain experiments
env:
GO_EXPERIMENT_IMAGE: litmuschaos/go-runner:ci
EXPERIMENT_IMAGE_PULL_POLICY: IfNotPresent
KUBECONFIG: /home/runner/.kube/config
run: make node-drain
- name: Running Node Taint experiments
if: always()
env:
GO_EXPERIMENT_IMAGE: litmuschaos/go-runner:ci
EXPERIMENT_IMAGE_PULL_POLICY: IfNotPresent
KUBECONFIG: /home/runner/.kube/config
run: make node-taint
- name: Deleting KinD cluster
if: always()
run: kind delete cluster