Skip to content

Commit 10284db

Browse files
authored
Add New GitHub Action for SLO Tests Integration with SDK (#513)
* ci: migrate to new slo action * refactor: rename sdk to workload in SLO workflows and metrics
1 parent 6f8a8f2 commit 10284db

File tree

6 files changed

+202
-119
lines changed

6 files changed

+202
-119
lines changed

.github/workflows/slo-report.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: SLO Report
2+
3+
on:
4+
workflow_run:
5+
workflows: ['SLO']
6+
types:
7+
- completed
8+
9+
jobs:
10+
ydb-slo-action-report:
11+
runs-on: ubuntu-latest
12+
name: Publish YDB SLO Report
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
if: github.event.workflow_run.conclusion == 'success'
17+
steps:
18+
- name: Publish YDB SLO Report
19+
uses: ydb-platform/ydb-slo-action/report@main
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
github_run_id: ${{ github.event.workflow_run.id }}

.github/workflows/slo.yml

Lines changed: 78 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,98 @@
11
name: SLO
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request:
5-
branches: [main]
8+
branches:
9+
- main
610
workflow_dispatch:
11+
inputs:
12+
github_pull_request_number:
13+
required: true
14+
slo_workload_duration_seconds:
15+
default: '600'
16+
required: false
17+
slo_workload_read_max_rps:
18+
default: '1000'
19+
required: false
20+
slo_workload_write_max_rps:
21+
default: '100'
22+
required: false
723

824
jobs:
9-
test-slo:
10-
concurrency:
11-
group: slo-${{ github.ref }}
25+
ydb-slo-action:
1226
if: (!contains(github.event.pull_request.labels.*.name, 'no slo'))
1327

28+
name: Run YDB SLO Tests
1429
runs-on: ubuntu-latest
15-
name: SLO test
16-
permissions:
17-
checks: write
18-
pull-requests: write
19-
contents: read
20-
issues: write
30+
31+
strategy:
32+
matrix:
33+
workload:
34+
- sync-table
35+
- sync-query
36+
37+
concurrency:
38+
group: slo-${{ github.ref }}-${{ matrix.workload }}
39+
cancel-in-progress: true
2140

2241
steps:
2342
- name: Checkout repository
24-
uses: actions/checkout@v3
25-
if: env.DOCKER_REPO != null
26-
env:
27-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
43+
uses: actions/checkout@v4
2844

29-
- name: Run SLO
30-
uses: ydb-platform/slo-tests@main
31-
if: env.DOCKER_REPO != null
32-
env:
33-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
34-
continue-on-error: true
45+
- name: Install Python3
46+
uses: actions/setup-python@v5
3547
with:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
KUBECONFIG_B64: ${{ secrets.SLO_KUBE_CONFIG }}
38-
AWS_CREDENTIALS_B64: ${{ secrets.SLO_AWS_CREDENTIALS }}
39-
AWS_CONFIG_B64: ${{ secrets.SLO_AWS_CONFIG }}
40-
DOCKER_USERNAME: ${{ secrets.SLO_DOCKER_USERNAME }}
41-
DOCKER_PASSWORD: ${{ secrets.SLO_DOCKER_PASSWORD }}
42-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
43-
DOCKER_FOLDER: ${{ secrets.SLO_DOCKER_FOLDER }}
44-
s3_endpoint: ${{ secrets.SLO_S3_ENDPOINT }}
45-
s3_images_folder: ${{ vars.SLO_S3_IMAGES_FOLDER }}
46-
grafana_domain: ${{ vars.SLO_GRAFANA_DOMAIN }}
47-
grafana_dashboard: ${{ vars.SLO_GRAFANA_DASHBOARD }}
48-
ydb_version: 'newest'
49-
timeBetweenPhases: 30
50-
shutdownTime: 30
48+
python-version: '3.8'
49+
cache: 'pip'
5150

52-
language_id0: sync-python-table
53-
language0: Python SDK over Table Service
54-
workload_path0: tests/slo
55-
workload_build_context0: ../..
56-
workload_build_options0: -f Dockerfile --build-arg SDK_SERVICE=sync-python-table
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --no-cache-dir --upgrade pip
54+
python -m pip install --no-cache-dir -e .
55+
python -m pip install --no-cache-dir -r tests/slo/requirements.txt
5756
58-
language_id1: sync-python-query
59-
language1: Python SDK over Query Service
60-
workload_path1: tests/slo
61-
workload_build_context1: ../..
62-
workload_build_options1: -f Dockerfile --build-arg SDK_SERVICE=sync-python-query
57+
- name: Initialize YDB SLO
58+
uses: ydb-platform/ydb-slo-action/init@main
59+
with:
60+
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
61+
github_token: ${{ secrets.GITHUB_TOKEN }}
62+
workload_name: ${{ matrix.workload }}
63+
ydb_database_node_count: 5
64+
65+
- name: Prepare SLO Database
66+
run: |
67+
python ./tests/slo/src create grpc://localhost:2135 /Root/testdb
6368
64-
- uses: actions/upload-artifact@v3
65-
if: env.DOCKER_REPO != null
69+
- name: Run SLO Tests
6670
env:
67-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
71+
REF: '${{ github.head_ref || github.ref }}'
72+
WORKLOAD: '${{ matrix.workload }}'
73+
run: |
74+
python ./tests/slo/src run grpc://localhost:2135 /Root/testdb \
75+
--prom-pgw localhost:9091 \
76+
--report-period 250 \
77+
--time ${{inputs.slo_workload_duration_seconds || 600}} \
78+
--read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \
79+
--write-rps ${{inputs.slo_workload_write_max_rps || 100}} \
80+
--read-timeout 1000 \
81+
--write-timeout 1000
82+
83+
- if: always()
84+
name: Cleanup SLO Database
85+
run: |
86+
python ./tests/slo/src cleanup grpc://localhost:2135 /Root/testdb
87+
88+
- if: always()
89+
name: Store ydb chaos testing logs
90+
run: |
91+
docker logs ydb-chaos > chaos-ydb.log
92+
93+
- if: always()
94+
uses: actions/upload-artifact@v4
6895
with:
69-
name: slo-logs
70-
path: logs/
96+
name: ${{ matrix.workload }}-chaos-ydb.log
97+
path: ./chaos-ydb.log
98+
retention-days: 1

tests/slo/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/slo/src/jobs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import threading
1010

11-
from metrics import Metrics, JOB_WRITE_LABEL, JOB_READ_LABEL
11+
from metrics import Metrics, OP_TYPE_WRITE, OP_TYPE_READ
1212

1313
from generator import RowGenerator
1414

@@ -106,7 +106,7 @@ def check_result(result):
106106
query=query,
107107
params=params,
108108
metrics=metrics,
109-
labels=(JOB_READ_LABEL,),
109+
labels=(OP_TYPE_READ,),
110110
request_settings=request_settings,
111111
retry_settings=retry_setting,
112112
check_result_cb=check_result,
@@ -163,7 +163,7 @@ def check_result(result):
163163
query=query,
164164
params=params,
165165
metrics=metrics,
166-
labels=(JOB_READ_LABEL,),
166+
labels=(OP_TYPE_READ,),
167167
request_settings=request_settings,
168168
retry_settings=retry_setting,
169169
check_result_cb=check_result,
@@ -220,7 +220,7 @@ def run_writes(driver, query, row_generator, metrics, limiter, runtime, timeout)
220220
query=query,
221221
params=params,
222222
metrics=metrics,
223-
labels=(JOB_WRITE_LABEL,),
223+
labels=(OP_TYPE_WRITE,),
224224
request_settings=request_settings,
225225
retry_settings=retry_setting,
226226
)
@@ -285,7 +285,7 @@ def check_result(result):
285285
query=query,
286286
params=params,
287287
metrics=metrics,
288-
labels=(JOB_WRITE_LABEL,),
288+
labels=(OP_TYPE_WRITE,),
289289
request_settings=request_settings,
290290
retry_settings=retry_setting,
291291
check_result_cb=check_result,

0 commit comments

Comments
 (0)