Skip to content

Commit fc1a19d

Browse files
authored
fix: docs bootstrap should fail on validation failure instead of only sending a slack message (#20671)
this disables the check in merge queue, but leaves it in the pr. it also introduces a simple retry
2 parents bef660a + b6bcfb7 commit fc1a19d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/examples/bootstrap.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function send_slack_message {
135135
FAILED_STEPS=()
136136
FAILED_OUTPUTS=()
137137

138-
# Run a step, collect failure if it fails
138+
# Run a step with retry, collect failure if it fails
139139
function run_step {
140140
local step_name=$1
141141
local step_func=$2
@@ -148,8 +148,18 @@ function run_step {
148148
set -e
149149
echo "$output"
150150

151+
# Retry once on failure
151152
if [[ $exit_code -ne 0 ]]; then
152-
echo "WARNING: $step_name failed (exit code $exit_code)"
153+
echo "WARNING: $step_name failed (exit code $exit_code), retrying..."
154+
set +e
155+
output=$($step_func 2>&1)
156+
exit_code=$?
157+
set -e
158+
echo "$output"
159+
fi
160+
161+
if [[ $exit_code -ne 0 ]]; then
162+
echo "WARNING: $step_name failed after retry (exit code $exit_code)"
153163
FAILED_STEPS+=("$step_name")
154164
FAILED_OUTPUTS+=("$output")
155165
fi
@@ -197,6 +207,11 @@ case "$cmd" in
197207

198208
if [[ ${#FAILED_STEPS[@]} -gt 0 ]]; then
199209
send_failure_slack_message
210+
# Block PRs on failure, but allow merge queue to proceed (may be transient infra issues)
211+
if [[ ! "$REF_NAME" =~ ^gh-readonly-queue/ ]]; then
212+
echo "ERROR: Docs examples validation failed. Failing the build."
213+
exit 1
214+
fi
200215
fi
201216
;;
202217
compile-circuits)

0 commit comments

Comments
 (0)