Skip to content

Commit 5662230

Browse files
committed
moved build logic to ext file
1 parent e718924 commit 5662230

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

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

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ Usage:
1010
--tag <docker-tag> \
1111
--src-path <sdk-path> \
1212
--job-name <job-name> \
13-
--ref <git-ref>
13+
--ref <git-ref> \
14+
--fallback-image <docker-tag>
1415
1516
Options:
16-
--context Docker build context directory (e.g. $GITHUB_WORKSPACE/current).
17-
--tag Docker image tag to build (e.g. ydb-app-current).
18-
--src-path Value for Docker build arg SRC_PATH (e.g. native/table).
19-
--job-name Value for Docker build arg JOB_NAME (e.g. native-table).
20-
--ref Value for Docker build arg REF (e.g. branch name / sha).
17+
--context Docker build context directory (e.g. $GITHUB_WORKSPACE/current).
18+
--tag Docker image tag to build (e.g. ydb-app-current).
19+
--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).
22+
--fallback-image Image tag to return if initial Docker image build fails
2123
EOF
2224
}
2325

@@ -32,6 +34,7 @@ tag=""
3234
ref=""
3335
src_path=""
3436
job_name=""
37+
fallback_image=""
3538

3639
while [[ $# -gt 0 ]]; do
3740
case "$1" in
@@ -55,6 +58,10 @@ while [[ $# -gt 0 ]]; do
5558
job_name="${2:-}"
5659
shift 2
5760
;;
61+
--fallback-image)
62+
fallback_image="${2:-}"
63+
shift 2
64+
;;
5865
-h|--help)
5966
usage
6067
exit 0
@@ -67,7 +74,7 @@ done
6774

6875
if [[ -z "$context_dir" || -z "$tag" || -z "$src_path" || -z "$job_name" || -z "$ref" ]]; then
6976
usage
70-
exit 2
77+
die "Incomplete argument set"
7178
fi
7279

7380
[[ -d "$context_dir" ]] || die "--context does not exist: $context_dir"
@@ -82,10 +89,22 @@ echo " SRC_PATH: $src_path"
8289
echo " JOB_NAME: $job_name"
8390

8491
(
92+
set +e
8593
cd "$context_dir"
8694
docker build -t "$tag" \
8795
--build-arg "SRC_PATH=$src_path" \
8896
--build-arg "JOB_NAME=$job_name" \
8997
--build-arg "REF=$ref" \
9098
-f "$dockerfile" .
99+
exit_code=$?
100+
echo "Docker build exit code: $exit_code"
101+
if [ $exit_code -ne 0 ]; then
102+
if [[ -z "$fallback_image" ]]; then
103+
die "Docker build failed and --fallback-image is not set" >&2
104+
fi
105+
106+
echo "Baseline build failed, using fallback image: $fallback_image"
107+
docker tag "$fallback_image" "$tag"
108+
fi
109+
set -e
91110
)

.github/workflows/slo.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
name: native-node-hints
8282
path: ./native/node_hints
8383
label: native/node_hints
84+
slo_workload_read_max_rps: 100
85+
slo_workload_write_max_rps: 100
8486
run_extra_args: '-batch-size=10'
8587
create_extra_args: '-min-partitions-count 10'
8688

@@ -174,7 +176,8 @@ jobs:
174176
--tag "ydb-app-baseline" \
175177
--ref "${{ steps.baseline.outputs.ref }}" \
176178
--src-path "${{ matrix.sdk.label }}" \
177-
--job-name "${{ matrix.sdk.name }}"
179+
--job-name "${{ matrix.sdk.name }}" \
180+
--fallback-image "ydb-app-current"
178181
179182
- name: Initialize YDB SLO
180183
id: ydb_slo

tests/slo/native/node_hints/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func main() {
152152
wg.Wait()
153153
w.FailOnError()
154154
// check all load is sent to a single node
155-
ectx, ecancel := context.WithTimeout(context.Background(), 1*time.Second)
155+
ectx, ecancel := context.WithTimeout(context.Background(), 10*time.Second)
156156
defer ecancel()
157157
estimator.OnlyThisNode(ectx, nodeID)
158158

0 commit comments

Comments
 (0)