Skip to content

Commit 1c55bbf

Browse files
Run all four SLO workloads in SDK workflow matrix.
Extend build-slo-image.sh with --workload and optional --jdbc checkout; JDBC tanks rebuild the driver against the SDK under test before packaging the workload jar. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent fe69f90 commit 1c55bbf

2 files changed

Lines changed: 97 additions & 94 deletions

File tree

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

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
#!/usr/bin/env bash
2-
#
3-
# Builds the Docker image for the YDB Java SDK SLO workload.
4-
#
5-
# The script assembles a temporary build context containing two checkouts
6-
# side by side — the SDK source tree and the ydb-java-examples checkout —
7-
# and feeds that context to `docker build` using the Dockerfile shipped
8-
# inside `ydb-java-examples/slo-workload/query/`.
9-
#
10-
# The Dockerfile takes care of building the SDK from source, installing it
11-
# into an in-image local Maven repository, and then building the workload
12-
# against that exact SDK version. So the script does not need any Maven /
13-
# JDK setup on the host; only `docker` and standard POSIX tools.
14-
#
15-
# If the initial build fails and `--fallback-image` is provided, the script
16-
# tags the fallback image as `--tag` and exits successfully. This mirrors
17-
# the behaviour of the equivalent script in `ydb-go-sdk` and is used by the
18-
# baseline build, where we want to keep going even if the historical commit
19-
# can't be built any more.
202

213
set -euo pipefail
224

@@ -26,20 +8,19 @@ Usage:
268
build-slo-image.sh \
279
--sdk <path> \
2810
--examples <path> \
11+
--workload <query|jdbc|spring-data-jdbc|spring-data-jpa> \
2912
--tag <docker-tag> \
13+
[--jdbc <path>] \
3014
[--fallback-image <docker-tag>]
3115
3216
Options:
3317
--sdk Path to the ydb-java-sdk checkout to build against.
34-
--examples Path to the ydb-java-examples checkout that owns the
35-
SLO workload sources (must contain
36-
slo-workload/query/Dockerfile).
37-
--tag Docker tag to assign to the built image
38-
(e.g. ydb-app-current).
18+
--examples Path to the ydb-java-examples checkout.
19+
--workload SLO workload module to build.
20+
--tag Docker tag to assign to the built image.
21+
--jdbc Path to ydb-jdbc-driver (required for JDBC workloads).
3922
--fallback-image If the initial Docker build fails, tag this image as
40-
--tag and exit successfully. Useful for the baseline
41-
build, which may be unable to compile a historical
42-
SDK commit.
23+
--tag and exit successfully.
4324
EOF
4425
}
4526

@@ -50,7 +31,9 @@ die() {
5031

5132
sdk_dir=""
5233
examples_dir=""
34+
workload=""
5335
tag=""
36+
jdbc_dir=""
5437
fallback_image=""
5538

5639
while [[ $# -gt 0 ]]; do
@@ -63,10 +46,18 @@ while [[ $# -gt 0 ]]; do
6346
examples_dir="${2:-}"
6447
shift 2
6548
;;
49+
--workload)
50+
workload="${2:-}"
51+
shift 2
52+
;;
6653
--tag)
6754
tag="${2:-}"
6855
shift 2
6956
;;
57+
--jdbc)
58+
jdbc_dir="${2:-}"
59+
shift 2
60+
;;
7061
--fallback-image)
7162
fallback_image="${2:-}"
7263
shift 2
@@ -81,40 +72,54 @@ while [[ $# -gt 0 ]]; do
8172
esac
8273
done
8374

84-
if [[ -z "$sdk_dir" || -z "$examples_dir" || -z "$tag" ]]; then
75+
if [[ -z "$sdk_dir" || -z "$examples_dir" || -z "$workload" || -z "$tag" ]]; then
8576
usage
8677
die "Incomplete argument set"
8778
fi
8879

80+
case "$workload" in
81+
query|jdbc|spring-data-jdbc|spring-data-jpa)
82+
;;
83+
*)
84+
die "Unsupported workload: $workload"
85+
;;
86+
esac
87+
88+
if [[ "$workload" != "query" && -z "$jdbc_dir" ]]; then
89+
die "--jdbc is required for workload ${workload}"
90+
fi
91+
8992
[[ -d "$sdk_dir" ]] || die "--sdk does not exist: $sdk_dir"
9093
[[ -d "$examples_dir" ]] || die "--examples does not exist: $examples_dir"
94+
if [[ -n "$jdbc_dir" ]]; then
95+
[[ -d "$jdbc_dir" ]] || die "--jdbc does not exist: $jdbc_dir"
96+
fi
9197

9298
sdk_dir="$(cd "$sdk_dir" && pwd)"
9399
examples_dir="$(cd "$examples_dir" && pwd)"
100+
if [[ -n "$jdbc_dir" ]]; then
101+
jdbc_dir="$(cd "$jdbc_dir" && pwd)"
102+
fi
94103

95-
dockerfile="${examples_dir}/slo-workload/query/Dockerfile"
104+
dockerfile="${examples_dir}/slo-workload/${workload}/Dockerfile"
96105
[[ -f "$dockerfile" ]] || die "Dockerfile not found: $dockerfile"
97106

98-
# Assemble a build context that contains the two checkouts side by side.
99-
# We use hard links where possible to avoid copying large amounts of data;
100-
# `cp -al` falls back to a regular copy when hard links aren't supported
101-
# (e.g. across filesystems on the GitHub runner cache).
102107
context_dir="$(mktemp -d)"
103108
trap 'rm -rf "$context_dir"' EXIT
104109

105110
echo "Assembling build context in $context_dir"
106111
echo " ydb-java-sdk: $sdk_dir"
107112
echo " ydb-java-examples: $examples_dir"
113+
echo " workload: $workload"
108114
echo " tag: $tag"
115+
if [[ -n "$jdbc_dir" ]]; then
116+
echo " ydb-jdbc-driver: $jdbc_dir"
117+
fi
109118

110119
copy_tree() {
111120
local src="$1"
112121
local dst="$2"
113122
mkdir -p "$dst"
114-
# The "/." suffix on src and "/" on dst asks cp to copy CONTENTS of src
115-
# into dst, regardless of whether dst pre-existed. Without this, partial
116-
# hardlink failures can leave dst partially populated and the fallback
117-
# then nests src inside dst (dst/src/...) instead of overwriting.
118123
if cp -al "$src"/. "$dst"/ 2>/dev/null; then
119124
return 0
120125
fi
@@ -123,23 +128,27 @@ copy_tree() {
123128

124129
copy_tree "$sdk_dir" "$context_dir/ydb-java-sdk"
125130
copy_tree "$examples_dir" "$context_dir/ydb-java-examples"
131+
if [[ -n "$jdbc_dir" ]]; then
132+
copy_tree "$jdbc_dir" "$context_dir/ydb-jdbc-driver"
133+
else
134+
mkdir -p "$context_dir/ydb-jdbc-driver"
135+
fi
126136

127-
# Drop .git from each copied tree so it doesn't ship into image layers or
128-
# confuse Maven plugins that probe for git metadata.
129-
rm -rf "$context_dir/ydb-java-sdk/.git" "$context_dir/ydb-java-examples/.git"
137+
rm -rf "$context_dir/ydb-java-sdk/.git" \
138+
"$context_dir/ydb-java-examples/.git" \
139+
"$context_dir/ydb-jdbc-driver/.git"
130140

131-
# Fail fast with a clear message if the layout is wrong (e.g. because of a
132-
# silent copy failure on the runner).
133141
for required in \
134142
"$context_dir/ydb-java-sdk/pom.xml" \
135-
"$context_dir/ydb-java-examples/slo-workload/query/Dockerfile"
143+
"$context_dir/ydb-java-examples/slo-workload/${workload}/Dockerfile"
136144
do
137145
[[ -f "$required" ]] || die "Build context missing required file: $required"
138146
done
139147

140-
echo "Build context layout:"
141-
ls -la "$context_dir"
142-
echo " ydb-java-sdk: $(ls -1 "$context_dir/ydb-java-sdk" | wc -l) entries"
148+
if [[ "$workload" != "query" ]]; then
149+
[[ -f "$context_dir/ydb-jdbc-driver/pom.xml" ]] \
150+
|| die "Build context missing required file: $context_dir/ydb-jdbc-driver/pom.xml"
151+
fi
143152

144153
set +e
145154
docker build \

.github/workflows/slo.yml

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
sdk:
20+
workload:
2121
- name: java-query-kv
22-
command: ""
22+
module: query
23+
- name: java-jdbc-kv
24+
module: jdbc
25+
- name: java-spring-data-jdbc-kv
26+
module: spring-data-jdbc
27+
- name: java-spring-data-jpa-kv
28+
module: spring-data-jpa
2329

2430
concurrency:
25-
group: slo-${{ github.ref }}-${{ matrix.sdk.name }}
31+
group: slo-${{ github.ref }}-${{ matrix.workload.name }}
2632
cancel-in-progress: true
2733

2834
steps:
@@ -93,67 +99,55 @@ jobs:
9399
ref: master
94100
path: examples
95101

102+
- name: Checkout ydb-jdbc-driver
103+
if: matrix.workload.module != 'query'
104+
uses: actions/checkout@v5
105+
with:
106+
repository: ydb-platform/ydb-jdbc-driver
107+
ref: master
108+
path: jdbc-driver
109+
96110
- name: Build current workload image
97111
run: |
98112
set -euxo pipefail
99113
chmod +x sdk-current/.github/scripts/build-slo-image.sh
100-
sdk-current/.github/scripts/build-slo-image.sh \
101-
--sdk sdk-current \
102-
--examples examples \
103-
--tag ydb-app-current
114+
args=(
115+
--sdk sdk-current
116+
--examples examples
117+
--workload ${{ matrix.workload.module }}
118+
--tag "ydb-app-current-${{ matrix.workload.module }}"
119+
)
120+
if [ "${{ matrix.workload.module }}" != "query" ]; then
121+
args+=(--jdbc jdbc-driver)
122+
fi
123+
sdk-current/.github/scripts/build-slo-image.sh "${args[@]}"
104124
105125
- name: Build baseline workload image
106126
run: |
107127
set -euxo pipefail
108-
# Reuse the build script from the current checkout — it doesn't
109-
# depend on SDK contents, only on the layout it produces.
110-
sdk-current/.github/scripts/build-slo-image.sh \
111-
--sdk sdk-baseline \
112-
--examples examples \
113-
--tag ydb-app-baseline \
114-
--fallback-image ydb-app-current
128+
args=(
129+
--sdk sdk-baseline
130+
--examples examples
131+
--workload ${{ matrix.workload.module }}
132+
--tag "ydb-app-baseline-${{ matrix.workload.module }}"
133+
--fallback-image "ydb-app-current-${{ matrix.workload.module }}"
134+
)
135+
if [ "${{ matrix.workload.module }}" != "query" ]; then
136+
args+=(--jdbc jdbc-driver)
137+
fi
138+
sdk-current/.github/scripts/build-slo-image.sh "${args[@]}"
115139
116140
- name: Run SLO Tests
117141
uses: ydb-platform/ydb-slo-action/init@v2
118142
timeout-minutes: 30
119143
with:
120144
github_issue: ${{ github.event.pull_request.number }}
121145
github_token: ${{ secrets.GITHUB_TOKEN }}
122-
workload_name: ${{ matrix.sdk.name }}
146+
workload_name: ${{ matrix.workload.name }}
123147
workload_duration: "600"
124148
workload_current_ref: ${{ github.head_ref || github.ref_name }}
125-
workload_current_image: ydb-app-current
126-
workload_current_command: ${{ matrix.sdk.command }} --read-rps 1000 --write-rps 100
149+
workload_current_image: ydb-app-current-${{ matrix.workload.module }}
150+
workload_current_command: --read-rps 1000 --write-rps 100
127151
workload_baseline_ref: ${{ steps.baseline.outputs.ref }}
128-
workload_baseline_image: ydb-app-baseline
129-
workload_baseline_command: ${{ matrix.sdk.command }} --read-rps 1000 --write-rps 100
130-
131-
# publish-slo-report:
132-
# needs: ydb-slo-action
133-
# runs-on: ubuntu-latest
134-
# name: Publish YDB SLO Report
135-
# permissions:
136-
# issues: write
137-
# checks: write
138-
# contents: read
139-
# pull-requests: write
140-
# steps:
141-
# - name: Checkout current SDK version
142-
# uses: actions/checkout@v5
143-
#
144-
# - name: Publish YDB SLO Report
145-
# uses: ydb-platform/ydb-slo-action/report@v2
146-
# with:
147-
# github_token: ${{ secrets.GITHUB_TOKEN }}
148-
# github_run_id: ${{ github.event.workflow_run.id }}
149-
#
150-
# - name: Remove SLO label from PR
151-
# env:
152-
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153-
# PRS: ${{ toJSON(github.event.workflow_run.pull_requests) }}
154-
# REPO: ${{ github.event.workflow_run.repository.full_name }}
155-
# run: |
156-
# set -euo pipefail
157-
# PR=$(jq -r '.[0].number' <<<"$PRS")
158-
# gh pr edit "$PR" --repo "$REPO" --remove-label SLO
159-
#
152+
workload_baseline_image: ydb-app-baseline-${{ matrix.workload.module }}
153+
workload_baseline_command: --read-rps 1000 --write-rps 100

0 commit comments

Comments
 (0)