Skip to content

Commit 232a989

Browse files
committed
Migrate ot v2 SLO Action
1 parent 6d309d5 commit 232a989

File tree

60 files changed

+5214
-4545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5214
-4545
lines changed

.github/scripts/build-slo-image.sh

100644100755
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ Usage:
99
--context <path> \
1010
--tag <docker-tag> \
1111
--src-path <sdk-path> \
12-
--job-name <job-name> \
13-
--ref <git-ref> \
1412
--fallback-image <docker-tag>
1513
1614
Options:
1715
--context Docker build context directory (e.g. $GITHUB_WORKSPACE/current).
1816
--tag Docker image tag to build (e.g. ydb-app-current).
1917
--src-path Value for Docker build arg SRC_PATH (e.g. native/table).
20-
--job-name Value for Docker build arg JOB_NAME (e.g. native-table).
21-
--ref Value for Docker build arg REF (e.g. branch name / sha).
2218
--fallback-image Image tag to return if initial Docker image build fails
2319
EOF
2420
}
@@ -31,9 +27,7 @@ die() {
3127
context_dir=""
3228
dockerfile="tests/slo/Dockerfile"
3329
tag=""
34-
ref=""
3530
src_path=""
36-
job_name=""
3731
fallback_image=""
3832

3933
while [[ $# -gt 0 ]]; do
@@ -46,22 +40,10 @@ while [[ $# -gt 0 ]]; do
4640
tag="${2:-}"
4741
shift 2
4842
;;
49-
--ref)
50-
ref="${2:-}"
51-
shift 2
52-
;;
5343
--src-path)
5444
src_path="${2:-}"
5545
shift 2
5646
;;
57-
--job-name)
58-
job_name="${2:-}"
59-
shift 2
60-
;;
61-
--fallback-image)
62-
fallback_image="${2:-}"
63-
shift 2
64-
;;
6547
-h|--help)
6648
usage
6749
exit 0
@@ -72,7 +54,7 @@ while [[ $# -gt 0 ]]; do
7254
esac
7355
done
7456

75-
if [[ -z "$context_dir" || -z "$tag" || -z "$src_path" || -z "$job_name" || -z "$ref" ]]; then
57+
if [[ -z "$context_dir" || -z "$tag" || -z "$src_path" ]]; then
7658
usage
7759
die "Incomplete argument set"
7860
fi
@@ -84,17 +66,14 @@ context_dir="$(cd "$context_dir" && pwd)"
8466

8567
echo "Building SLO image..."
8668
echo " TAG: $tag"
87-
echo " REF: $ref"
8869
echo " SRC_PATH: $src_path"
89-
echo " JOB_NAME: $job_name"
9070

9171
(
9272
set +e
9373
cd "$context_dir"
9474
docker build -t "$tag" \
75+
--platform linux/amd64 \
9576
--build-arg "SRC_PATH=$src_path" \
96-
--build-arg "JOB_NAME=$job_name" \
97-
--build-arg "REF=$ref" \
9877
-f "$dockerfile" .
9978
exit_code=$?
10079
echo "Docker build exit code: $exit_code"

.github/workflows/slo.yml

Lines changed: 43 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -41,59 +41,26 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
sdk:
44-
- id: database_sql_table
45-
name: database-sql-table
46-
path: ./database/sql/table
47-
label: database/sql/table
48-
run_extra_args: ''
49-
create_extra_args: ''
50-
- id: database_sql_query
51-
name: database-sql-query
52-
path: ./database/sql/query
53-
label: database/sql/query
54-
run_extra_args: ''
55-
create_extra_args: ''
56-
- id: native_query
57-
name: native-query
58-
path: ./native/query
59-
label: native/query
60-
run_extra_args: ''
61-
create_extra_args: ''
62-
- id: native_table
63-
name: native-table
64-
path: ./native/table
65-
label: native/table
66-
run_extra_args: ''
67-
create_extra_args: ''
68-
- id: native_table_over_query_service
69-
name: native-table-over-query-service
70-
path: ./native/table/over/query/service
71-
label: native/table/over/query/service
72-
run_extra_args: ''
73-
create_extra_args: ''
74-
- id: native_bulk_upsert
75-
name: native-bulk-upsert
76-
path: ./native/bulk-upsert
77-
label: native/bulk-upsert
78-
run_extra_args: '-batch-size=10'
79-
create_extra_args: ''
80-
- id: native_node_hints
81-
name: native-node-hints
82-
path: ./native/node_hints
83-
label: native/node_hints
84-
slo_workload_read_max_rps: 100
85-
slo_workload_write_max_rps: 100
86-
run_extra_args: '-batch-size=10'
87-
create_extra_args: '-min-partitions-count 10'
88-
- id: session_node_hints
89-
name: session-node-hints
90-
path: ./native/session_node_hints
91-
label: native/session_node_hints
92-
slo_workload_read_max_rps: 1000
93-
slo_workload_write_max_rps: 1
94-
run_extra_args: '-batch-size=10'
95-
create_extra_args: '-min-partitions-count 10'
96-
44+
- name: database-sql-table
45+
path: database/sql/table
46+
- name: database-sql-query
47+
path: database/sql/query
48+
- name: native-query
49+
path: native/query
50+
- name: native-table
51+
path: native/table
52+
- name: native-table-over-query-service
53+
path: native/table-over-query-service
54+
- name: native-bulk-upsert
55+
path: native/bulk-upsert
56+
run_extra_args: "-batch-size=10"
57+
- name: native-table-node-hints
58+
path: native/table-node-hints
59+
run_extra_args: "-batch-size=10"
60+
create_extra_args: "-min-partitions-count 10"
61+
- name: native-query-node-hints
62+
path: native/query-node-hints
63+
create_extra_args: "-min-partitions-count 10"
9764

9865
concurrency:
9966
group: slo-${{ github.ref }}-${{ matrix.sdk.name }}
@@ -176,133 +143,44 @@ jobs:
176143
bash "$SCRIPT" \
177144
--context "$GITHUB_WORKSPACE/current" \
178145
--tag "ydb-app-current" \
179-
--ref "${CURRENT_REF}" \
180-
--src-path "${{ matrix.sdk.label }}" \
181-
--job-name "${{ matrix.sdk.name }}"
146+
--src-path "${{ matrix.sdk.path }}"
182147
183148
bash "$SCRIPT" \
184149
--context "$GITHUB_WORKSPACE/baseline" \
185150
--tag "ydb-app-baseline" \
186-
--ref "${{ steps.baseline.outputs.ref }}" \
187-
--src-path "${{ matrix.sdk.label }}" \
188-
--job-name "${{ matrix.sdk.name }}" \
189-
--fallback-image "ydb-app-current"
151+
--src-path "${{ matrix.sdk.path }}"
190152
191-
- name: Initialize YDB SLO
192-
id: ydb_slo
193-
uses: ydb-platform/ydb-slo-action/init@13c687b7d4b2879da79dd12932dee0ed2b65dd1c
153+
- name: Run SLO Tests
154+
uses: ydb-platform/ydb-slo-action/init@v2
155+
timeout-minutes: 30
194156
with:
195157
github_issue: ${{ github.event.inputs.github_issue }}
196158
github_token: ${{ secrets.GITHUB_TOKEN }}
197159
workload_name: ${{ matrix.sdk.name }}
160+
workload_duration: ${{ inputs.slo_workload_duration_seconds || '600' }}
198161
workload_current_ref: ${{ github.head_ref || github.ref_name }}
162+
workload_current_image: ydb-app-current
199163
workload_baseline_ref: ${{ steps.baseline.outputs.ref }}
200-
# to disable chaos testing for node hint workloads
201-
disable_compose_profiles: "${{ (matrix.sdk.id == 'native_node_hints' || matrix.sdk.id == 'session_node_hints') && 'chaos' || '' }}"
164+
workload_baseline_image: ydb-app-current
165+
disable_compose_profiles: "${{ (matrix.sdk.name == 'native-table-node-hints' || matrix.sdk.name == 'native-query-node-hints') && 'chaos' || '' }}"
202166
metrics_yaml: |
203167
metrics:
204168
- name: node_hints_misses
205169
type: instant
206170
query: sum by(ref) (workload_node_hints_misses)
207171
208-
- name: Prepare SLO Database
209-
run: |
210-
echo "Preparing SLO database..."
211-
CREATE_EXTRA_ARGS="${{ matrix.sdk.create_extra_args }}"
212-
docker run --rm --network ydb_ydb-net \
213-
--add-host "ydb:172.28.0.11" \
214-
--add-host "ydb:172.28.0.12" \
215-
--add-host "ydb:172.28.0.13" \
216-
--add-host "ydb:172.28.0.99" \
217-
ydb-app-current create grpc://ydb:2136 /Root/testdb $CREATE_EXTRA_ARGS
218-
219-
- name: Run SLO Tests (parallel)
220-
timeout-minutes: 15
221-
env:
222-
DURATION: ${{ matrix.sdk.slo_workload_duration_seconds || 600 }}
223-
READ_RPS: ${{ matrix.sdk.slo_workload_read_max_rps || 1000 }}
224-
WRITE_RPS: ${{ matrix.sdk.slo_workload_write_max_rps || 1000 }}
225-
RUN_EXTRA_ARGS: ${{ format('{0} -prometheus-endpoint {1}',matrix.sdk.run_extra_args,steps.ydb_slo.outputs.ydb-prometheus-url)}}
226-
run: |
227-
ARGS="run grpc://ydb:2136 /Root/testdb \
228-
-otlp-endpoint prometheus:9090 \
229-
-report-period 250 \
230-
-time $DURATION \
231-
-read-rps $READ_RPS \
232-
-write-rps $WRITE_RPS \
233-
-read-timeout 100 \
234-
-write-timeout 100 \
235-
$RUN_EXTRA_ARGS"
236-
237-
echo "Starting ydb-app-current..."
238-
docker run -d \
239-
--name ydb-app-current \
240-
--network ydb_ydb-net \
241-
--add-host "ydb:172.28.0.11" \
242-
--add-host "ydb:172.28.0.12" \
243-
--add-host "ydb:172.28.0.13" \
244-
--add-host "ydb:172.28.0.99" \
245-
ydb-app-current $ARGS
246-
247-
echo "Starting ydb-app-baseline..."
248-
docker run -d \
249-
--name ydb-app-baseline \
250-
--network ydb_ydb-net \
251-
--add-host "ydb:172.28.0.11" \
252-
--add-host "ydb:172.28.0.12" \
253-
--add-host "ydb:172.28.0.13" \
254-
--add-host "ydb:172.28.0.99" \
255-
ydb-app-baseline $ARGS
256-
257-
# Show initial logs
258-
echo ""
259-
echo "==================== INITIAL CURRENT LOGS ===================="
260-
docker logs -n 15 ydb-app-current 2>&1 || echo "No current container"
261-
echo ""
262-
echo "==================== INITIAL BASELINE LOGS ===================="
263-
docker logs -n 15 ydb-app-baseline 2>&1 || echo "No baseline container"
264-
echo ""
265-
266-
# Wait for workloads to complete
267-
echo "Waiting for workloads to complete (${DURATION}s)..."
268-
sleep ${DURATION}
269-
270-
# Stop containers after workload duration and wait for graceful shutdown
271-
echo "Stopping containers after ${DURATION}s..."
272-
docker stop --timeout=30 ydb-app-current ydb-app-baseline 2>&1 || true
273-
274-
# Force kill if still running
275-
docker kill ydb-app-current ydb-app-baseline 2>&1 || true
276-
277-
# Check exit codes
278-
CURRENT_EXIT=$(docker inspect ydb-app-current --format='{{.State.ExitCode}}' 2>/dev/null || echo "1")
279-
BASELINE_EXIT=$(docker inspect ydb-app-baseline --format='{{.State.ExitCode}}' 2>/dev/null || echo "0")
280-
281-
echo "Current container exit code: $CURRENT_EXIT"
282-
echo "Baseline container exit code: $BASELINE_EXIT"
283-
284-
# Show final logs
285-
echo ""
286-
echo "==================== FINAL CURRENT LOGS ===================="
287-
docker logs -n 15 ydb-app-current 2>&1 || echo "No current container"
288-
echo ""
289-
echo "==================== FINAL BASELINE LOGS ===================="
290-
docker logs -n 15 ydb-app-baseline 2>&1 || echo "No baseline container"
291-
echo ""
292-
293-
echo "SUCCESS: Workloads completed successfully"
294-
295-
- if: always()
296-
name: Store logs
297-
run: |
298-
docker logs ydb-app-current > current.log 2>&1 || echo "No current container"
299-
docker logs ydb-app-baseline > baseline.log 2>&1 || echo "No baseline container"
300-
301-
- if: always()
302-
uses: actions/upload-artifact@v4
172+
ydb-slo-report:
173+
if: always()
174+
needs: ydb-slo-action
175+
runs-on: ubuntu-latest
176+
name: Publish YDB SLO Report
177+
permissions:
178+
checks: write
179+
contents: read
180+
pull-requests: write
181+
steps:
182+
- name: Publish YDB SLO Report
183+
uses: ydb-platform/ydb-slo-action/report@v2
303184
with:
304-
name: ${{matrix.sdk.name}}-logs
305-
path: |
306-
./current.log
307-
./baseline.log
308-
retention-days: 1
185+
github_token: ${{ secrets.GITHUB_TOKEN }}
186+
github_run_id: ${{ github.run_id }}

tests/slo/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
FROM golang:1.24 AS build
22
ARG SRC_PATH
3-
ARG JOB_NAME
4-
ARG REF=unknown
53
COPY . /src
64
WORKDIR /src/tests/slo/${SRC_PATH}
7-
RUN CGO_ENABLED=0 go build -o /build/slo-go-workload -ldflags "-X \"main.ref=${REF}\" -X \"main.label=${SRC_PATH}\" -X \"main.jobName=${JOB_NAME}\"" .
5+
RUN CGO_ENABLED=0 go build -o /build/slo-go-workload .
86

97
FROM scratch
108
COPY --from=build /build /

0 commit comments

Comments
 (0)