fix(cd): preserve docker push retries
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 59s
CD Pipeline / build-and-deploy (push) Successful in 6m46s
CD Pipeline / post-deploy-checks (push) Successful in 3m4s

This commit is contained in:
ogt
2026-07-11 12:44:12 +08:00
parent 34c942689b
commit 6cb73aa566
2 changed files with 20 additions and 8 deletions

View File

@@ -1658,10 +1658,11 @@ jobs:
local rc=1
while [ "${attempt}" -le "${max_attempts}" ]; do
echo "cd_docker_push_attempt=${label}:${attempt}/${max_attempts}"
set +e
run_docker_step "${label}" "${timeout_seconds}" "$@"
rc=$?
set -e
if run_docker_step "${label}" "${timeout_seconds}" "$@"; then
rc=0
else
rc=$?
fi
if [ "${rc}" -eq 0 ]; then
return 0
fi
@@ -1733,10 +1734,11 @@ jobs:
local rc=1
while [ "${attempt}" -le "${max_attempts}" ]; do
echo "cd_docker_push_attempt=${label}:${attempt}/${max_attempts}"
set +e
run_docker_step "${label}" "${timeout_seconds}" "$@"
rc=$?
set -e
if run_docker_step "${label}" "${timeout_seconds}" "$@"; then
rc=0
else
rc=$?
fi
if [ "${rc}" -eq 0 ]; then
return 0
fi

View File

@@ -439,6 +439,16 @@ def test_cd_docker_build_and_push_steps_are_bounded_and_classified() -> None:
assert "BLOCKER cd_docker_step_timeout label=${label}" in block
assert 'CD_DOCKER_PUSH_ATTEMPTS:-3' in block
assert "cd_docker_push_attempt=${label}:${attempt}/${max_attempts}" in block
assert (
'if run_docker_step "${label}" "${timeout_seconds}" "$@"; then'
in block
)
assert "rc=0\n else\n rc=$?" in block
assert (
'set +e\n run_docker_step "${label}" '
'"${timeout_seconds}" "$@"'
not in block
)
assert "BLOCKER cd_docker_push_failed label=${label}" in block
assert (
"NEXT_ACTION inspect_cd_runner_docker_build_push_or_registry_route_then_rerun_cd"