-
Notifications
You must be signed in to change notification settings - Fork 11
272 lines (260 loc) · 12 KB
/
load-test.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
name: Run a Load Test
run-name: ${{ inputs.playback-protocol }} load Test ${{ inputs.environment }} ${{ inputs.duration }} ${{ inputs.playback-region-viewers-json }}
on:
workflow_dispatch:
inputs:
environment:
description: Environment to load test
required: true
type: choice
options: [ "production", "staging" ]
default: "staging"
duration:
description: Duration of the test
required: true
type: string
default: 5m
streamer-region:
description: Streamer region (from Google Cloud)
type: string
required: true
default: us-central1
playback-protocol:
description: Playback protocol
required: true
type: choice
options: [ "WebRTC", "HLS" ]
default: "WebRTC"
access-control:
description: Enable JWT access control
type: boolean
required: true
default: false
playback-region-viewers-json:
description: Number of viewers per region (from Google Cloud)
type: string
required: true
default: '{"us-central1":20,"europe-west2":20,"asia-southeast1":20}'
streamer-input-file:
description: File to ingest
type: string
required: true
default: 'https://test-harness-gcp.livepeer.fish/countdown_720p_30fps_2sGOP_noBframes_5min.mp4'
region:
description: "(Optional) Single-node test: Region of node to be tested (also needs pod index below). e.g.: mdw"
type: string
required: false
pod-index:
description: "(Optional) Single-node test: Index of the Catalyst pod to be tested (also needs region above). e.g.: 0"
type: string
required: false
extra-args:
description: "(Optional) Additional arguments to send to load test orchestrator"
type: string
required: false
jobs:
load-test:
name: Run ${{ inputs.playback-protocol }} load test
runs-on: ubuntu-latest
container:
image: livepeer/webrtc-load-tester:master
steps:
- name: calculate-dates-and-times
id: timestamp
uses: lee-dohm/[email protected]
with:
format: ""
- name: Discord start notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ github.triggering_actor }}
DISCORD_EMBEDS: >
[{
"title": "${{ inputs.playback-protocol }} load test starting",
"description": "A load test is starting in **${{ inputs.environment }}**",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"timestamp": "${{ steps.timestamp.outputs.date }}",
"author": {
"name": "${{ github.triggering_actor }}",
"url": "${{ github.server_url }}/${{ github.triggering_actor }}",
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32"
},
"fields": [{
"name": "Environment",
"value": "${{ inputs.environment }}",
"inline": true
}, {
"name": "Triggered timestamp",
"value": "${{ steps.timestamp.outputs.date }}",
"inline": true
}, {
"name": "Duration",
"value": "${{ inputs.duration }}",
"inline": true
}, {
"name": "Streamer region",
"value": "${{ inputs.streamer-region }}",
"inline": true
}, {
"name": "Viewers regions",
"value": ${{ toJSON(inputs.playback-region-viewers-json) }},
"inline": true
}, {
"name": "Single-node target",
"value": "${{ inputs.region }}-${{ inputs.pod-index }}",
"inline": true
}, {
"name": "Access control",
"value": "${{ inputs.access-control }}",
"inline": true
}]
}]
- name: Prepare environment
id: env
run: |
# Base configs
if [ "${{ inputs.environment }}" = "production" ]; then
API_SERVER="livepeer.com"
API_TOKEN="${{ secrets.LOAD_TEST_PROD_API_KEY }}"
STREAMER_BASE_URL="rtmp://rtmp.livepeer.com/live/"
PLAYBACK_BASE_URL="https://lvpr.tv/"
if [ "${{ inputs.access-control }}" = "true" ]; then
if [ -z "${{ inputs.region }}" ] && [ -z "${{ inputs.pod-index }}" ]; then
echo "Error: access-control is only available for single node tests"
exit 1
fi
PLAYBACK_JWT_PRIVATE_KEY="${{ secrets.LOAD_TEST_PROD_JWT_PRIVATE_KEY }}"
fi
else
API_SERVER="livepeer.monster"
API_TOKEN="${{ secrets.LOAD_TEST_STAGING_API_KEY }}"
STREAMER_BASE_URL="rtmp://rtmp.livepeer.monster/live/"
PLAYBACK_BASE_URL="https://monster.lvpr.tv/"
if [ "${{ inputs.access-control }}" = "true" ]; then
if [ -z "${{ inputs.region }}" ] && [ -z "${{ inputs.pod-index }}" ]; then
echo "Error: access-control is only available for single node tests"
exit 1
fi
PLAYBACK_JWT_PRIVATE_KEY="${{ secrets.LOAD_TEST_STAGING_JWT_PRIVATE_KEY }}"
fi
fi
# Override with inputs
if [ -n "${{ inputs.region }}" ] && [ -n "${{ inputs.pod-index }}" ]; then
if [ "${{ inputs.environment }}" = "production" ]; then
STREAMER_BASE_URL="rtmp://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/live"
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/webrtc/video+%s"
if [ "${{ inputs.playback-protocol }}" = "HLS" ]; then
PLAYBACK_BASE_URL="${PLAYBACK_BASE_URL}?lowLatency=false"
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/hls/video+%s/index.m3u8"
fi
else
STREAMER_BASE_URL="rtmp://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/live"
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/webrtc/video+%s"
if [ "${{ inputs.playback-protocol }}" = "HLS" ]; then
PLAYBACK_BASE_URL="${PLAYBACK_BASE_URL}?lowLatency=false"
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/hls/video+%s/index.m3u8"
fi
fi
fi
echo "api-server=${API_SERVER}" >> "${GITHUB_OUTPUT}"
echo "api-token=${API_TOKEN}" >> "${GITHUB_OUTPUT}"
echo "streamer-base-url=${STREAMER_BASE_URL}" >> "${GITHUB_OUTPUT}"
echo "playback-base-url=${PLAYBACK_BASE_URL}" >> "${GITHUB_OUTPUT}"
echo "playback-manifest-url=${PLAYBACK_MANIFEST_URL}" >> "${GITHUB_OUTPUT}"
echo "playback-jwt-private-key=${PLAYBACK_JWT_PRIVATE_KEY}" >> "${GITHUB_OUTPUT}"
- name: Load Test
run: webrtc-load-tester orchestrator ${{ inputs.extra-args }}
env:
LT_WEBRTC_DURATION: ${{ inputs.duration }}
LT_WEBRTC_API_SERVER: ${{ steps.env.outputs.api-server }}
LT_WEBRTC_API_TOKEN: ${{ steps.env.outputs.api-token }}
LT_WEBRTC_STREAMER_REGION: ${{ inputs.streamer-region }}
LT_WEBRTC_STREAMER_BASE_URL: ${{ steps.env.outputs.streamer-base-url }}
LT_WEBRTC_STREAMER_INPUT_FILE: ${{ inputs.streamer-input-file }}
LT_WEBRTC_PLAYBACK_BASE_URL: ${{ steps.env.outputs.playback-base-url }}
LT_WEBRTC_PLAYBACK_MANIFEST_URL: "${{ steps.env.outputs.playback-manifest-url }}"
LT_WEBRTC_PLAYBACK_JWT_PRIVATE_KEY: ${{ steps.env.outputs.playback-jwt-private-key }}
LT_WEBRTC_PLAYBACK_VIEWERS_PER_WORKER: 10
LT_WEBRTC_PLAYBACK_MACHINE_TYPE: n2-highcpu-4
LT_WEBRTC_PLAYBACK_REGION_VIEWERS_JSON: '${{ inputs.playback-region-viewers-json }}'
LT_WEBRTC_PLAYBACK_BASE_SCREENSHOT_FOLDER_OS: ${{ secrets.LOAD_TEST_SCREENSHOT_FOLDER_OS }}
LT_WEBRTC_GOOGLE_CREDENTIALS_JSON: '${{ secrets.LOAD_TEST_GOOGLE_CREDENTIALS_JSON }}'
- name: Discord finish notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ github.triggering_actor }}
DISCORD_EMBEDS: >
[{
"title": "${{ inputs.playback-protocol }} load test finished successfully",
"description": "The load test has finished successfully",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": 24576,
"author": {
"name": "${{ github.triggering_actor }}",
"url": "${{ github.server_url }}/${{ github.triggering_actor }}",
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32"
},
"fields": [{
"name": "Environment",
"value": "${{ inputs.environment }}",
"inline": true
}, {
"name": "Triggered timestamp",
"value": "${{ steps.timestamp.outputs.date }}",
"inline": true
}]
}]
- name: Discord failure notification
uses: Ilshidur/[email protected]
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ github.triggering_actor }}
DISCORD_EMBEDS: >
[{
"title": "${{ inputs.playback-protocol }} load test has failed!",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": 8388608,
"author": {
"name": "${{ github.triggering_actor }}",
"url": "${{ github.server_url }}/${{ github.triggering_actor }}",
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32"
},
"fields": [{
"name": "Environment",
"value": "${{ inputs.environment }}",
"inline": true
}, {
"name": "Triggered timestamp",
"value": "${{ steps.timestamp.outputs.date }}",
"inline": true
}]
}]
- name: Discord cancel notification
uses: Ilshidur/[email protected]
if: cancelled()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ github.triggering_actor }}
DISCORD_EMBEDS: >
[{
"title": "${{ inputs.playback-protocol }} load test was cancelled!",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": 11778048,
"author": {
"name": "${{ github.triggering_actor }}",
"url": "${{ github.server_url }}/${{ github.triggering_actor }}",
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32"
},
"fields": [{
"name": "Environment",
"value": "${{ inputs.environment }}",
"inline": true
}, {
"name": "Triggered timestamp",
"value": "${{ steps.timestamp.outputs.date }}",
"inline": true
}]
}]