forked from layer5io/meshery-performance-action
-
Notifications
You must be signed in to change notification settings - Fork 0
292 lines (262 loc) · 12.4 KB
/
scheduled-benchmarks-self-hosted.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
# This workflow runs performance benchmarks with Meshery based on the configuration provided
# This workflow is scheduled to run daily but can also be triggered manually
name: Scheduled Benchmark Tests on Self-hosted Runner
on:
# for triggering manually, provide a test configuration file name or a performance profile name
workflow_dispatch:
inputs:
profile_name:
description: "performance profile to use"
required: false
profile_filename:
description: "test configuration file"
required: false
# scheduled to run on everyhour
schedule:
- cron: '0 * * * *'
jobs:
# Manual Benchmark Test
start-runners-manual:
name: Start self-hosted CNCF CIL runners for manual test
timeout-minutes: 60
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd']
load-generator: ['fortio', 'wrk2']
outputs:
github_run_id: ${{ env.GITHUB_RUN_ID }} # use this github_run_id as a suffix for CIL machines and runners
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Configure CNCF CIL credentials
run: |
chmod +x .github/workflows/scripts/self-hosted-credentails.sh
.github/workflows/scripts/self-hosted-credentails.sh ${{ secrets.CNCF_CIL_TOKEN }}
shell: bash
- name: Create registration token for CNCF CIL runner
id: getRegToken
run: |
reg_token=$(curl -s -X POST -H "Accept: application/vnd.github.v3+json" \
-H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' \
https://api.github.com/repos/${{github.repository}}/actions/runners/registration-token | jq -r .token)
echo REG_TOKEN=$reg_token >> $GITHUB_ENV
echo REPOSITORY=${{github.repository}} >> $GITHUB_ENV
shell: bash
# The hostname will be like istio-fortio-1997512481
- name: Start CNCF CIL runner
id: start-cil-runner
run: |
echo GITHUB_RUN_ID=${{ github.run_id }} >> $GITHUB_ENV
chmod +x .github/workflows/scripts/start-cil-runner.sh
.github/workflows/scripts/start-cil-runner.sh ${{ secrets.cncf_cil_token }} ${{ matrix.service-mesh }}-${{ matrix.load-generator }}
shell: bash
manual-test:
name: Manual Benchmark Test
timeout-minutes: 60
needs:
- start-runners-manual
runs-on: ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ github.run_id }}
if: ${{ github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd']
load-generator: ['fortio', 'wrk2']
steps:
- name: Install dependencies
run: |
echo "Current user: $(whoami)"
echo "Installing kubectl..."
curl -LO https://dl.k8s.io/release/v1.23.2/bin/linux/amd64/kubectl
sudo install -o smp -g smp -m 0755 kubectl /usr/local/bin/kubectl
echo "Installing docker..."
sudo apt update -y
sudo apt install -y jq unzip apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo systemctl status docker
sudo mkdir -p ~/.kube
sudo chmod 777 ~/.kube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
- name: Start minikube
run: |
minikube start --memory 5000
kubectl get po -A
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Service Mesh and Deploy Application
run: |
chmod +x .github/workflows/scripts/${{ matrix.service-mesh }}_deploy.sh
.github/workflows/scripts/${{ matrix.service-mesh }}_deploy.sh
shell: bash
- name: Get Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H.%M.%S')"
- name: Run Benchmark Tests
uses: layer5io/meshery-smp-action@master
with:
provider_token: ${{ secrets.MESHERY_TOKEN }}
platform: docker
profile_name: ${{ github.event.inputs.profile_name }}
profile_filename: ${{ github.event.inputs.profile_filename }}
endpoint_url: ${{env.ENDPOINT_URL}}
service_mesh: ${{env.SERVICE_MESH}}
load_generator: ${{ matrix.load-generator }}
test_name: '${{ steps.date.outputs.date }}'
stop-runner-manual:
name: Stop self-hosted runner
timeout-minutes: 60
needs:
- start-runners-manual # required to get output from the start-runner job
- manual-test # required to wait when the main job is done
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd']
load-generator: ['fortio', 'wrk2']
if: ${{ always() && github.event_name == 'workflow_dispatch' }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Stop CNCF CIL runner
run: |
chmod +x .github/workflows/scripts/stop-cil-runner.sh
.github/workflows/scripts/stop-cil-runner.sh ${{ secrets.cncf_cil_token }} ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ needs.start-runners-manual.outputs.github_run_id }}
shell: bash
- name: Remove CNCF CIL runner from github repository
if: always()
run: |
runner_id=$(curl -s -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners | jq '.runners[] | select(.name == "${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ needs.start-runners-manual.outputs.github_run_id }}") | {id}' | jq -r .id)
curl -X DELETE -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners/$runner_id
shell: bash
# Scheduled Benchmark Test
start-runners-scheduled:
name: Start self-hosted CNCF CIL runners for scheduled test
timeout-minutes: 60
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd', 'osm']
load-generator: ['fortio', 'wrk2']
test-configuration: ['load-test','soak-test']
outputs:
github_run_id: ${{ env.GITHUB_RUN_ID }} # use this github_run_id as a suffix for CIL machines and runners
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Configure CNCF CIL credentials
run: |
chmod +x .github/workflows/scripts/self-hosted-credentails.sh
.github/workflows/scripts/self-hosted-credentails.sh ${{ secrets.CNCF_CIL_TOKEN }}
shell: bash
- name: Create registration token for CNCF CIL runner
id: getRegToken
run: |
reg_token=$(curl -s -X POST -H "Accept: application/vnd.github.v3+json" \
-H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' \
https://api.github.com/repos/${{github.repository}}/actions/runners/registration-token | jq -r .token)
echo REG_TOKEN=$reg_token >> $GITHUB_ENV
echo REPOSITORY=${{github.repository}} >> $GITHUB_ENV
shell: bash
# The hostname will be like istio-fortio-load-test-1997512481
- name: Start CNCF CIL runner
id: start-cil-runner
run: |
echo GITHUB_RUN_ID=${{ github.run_id }} >> $GITHUB_ENV
chmod +x .github/workflows/scripts/start-cil-runner.sh
.github/workflows/scripts/start-cil-runner.sh ${{ secrets.cncf_cil_token }} ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}
shell: bash
scheduled-test:
name: Scheduled Benchmark Test
timeout-minutes: 60
needs:
- start-runners-scheduled
runs-on: ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}-${{ github.run_id }}
if: ${{ github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd', 'osm']
load-generator: ['fortio', 'wrk2']
test-configuration: ['load-test','soak-test']
steps:
- name: Install dependencies
run: |
echo "Current user: $(whoami)"
echo "Installing kubectl..."
curl -LO https://dl.k8s.io/release/v1.23.2/bin/linux/amd64/kubectl
sudo install -o smp -g smp -m 0755 kubectl /usr/local/bin/kubectl
echo "Installing docker..."
sudo apt update -y
sudo apt install -y jq unzip apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo systemctl status docker
sudo mkdir -p ~/.kube
sudo chmod 777 ~/.kube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
- name: Start minikube
run: |
minikube start --memory 5000
kubectl get po -A
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Service Mesh and Deploy Application
run: |
chmod +x .github/workflows/scripts/${{ matrix.service-mesh }}_deploy.sh
.github/workflows/scripts/${{ matrix.service-mesh }}_deploy.sh
shell: bash
- name: Get Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H.%M.%S')"
- name: Run Benchmark Tests
uses: layer5io/meshery-smp-action@master
with:
provider_token: ${{ secrets.MESHERY_TOKEN }}
platform: docker
profile_filename: ${{ matrix.test-configuration }}.yaml
endpoint_url: ${{env.ENDPOINT_URL}}
service_mesh: ${{env.SERVICE_MESH}}
load_generator: ${{ matrix.load-generator }}
profile_name: '${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}'
test_name: '${{ steps.date.outputs.date }}'
stop-runner-scheduled:
name: Stop self-hosted runner
timeout-minutes: 60
needs:
- start-runners-scheduled # required to get output from the start-runner job
- scheduled-test # required to wait when the main job is done
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service-mesh: ['istio', 'linkerd', 'osm']
load-generator: ['fortio', 'wrk2']
test-configuration: ['load-test','soak-test']
if: ${{ always() && github.event_name == 'schedule' }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Stop CNCF CIL runner
run: |
chmod +x .github/workflows/scripts/stop-cil-runner.sh
.github/workflows/scripts/stop-cil-runner.sh ${{ secrets.cncf_cil_token }} ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}-${{ needs.start-runners-scheduled.outputs.github_run_id }}
shell: bash
- name: Remove CNCF CIL runner from github repository
if: always()
run: |
runner_id=$(curl -s -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners | jq '.runners[] | select(.name == "${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}-${{ needs.start-runners-scheduled.outputs.github_run_id }}") | {id}' | jq -r .id)
curl -X DELETE -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners/$runner_id
shell: bash