DEVX-163: fix: check stdout for HTTP 500 in _run_push (docker sends to stdout)
Post-merge / detect-and-configure (push) Successful in 12s
Post-merge / release-and-maintain (push) Successful in 1m20s

This commit was merged in pull request #307.
This commit is contained in:
2026-08-26 13:40:24 +00:00
parent 25f00335df
commit 62412755cb
3 changed files with 58 additions and 9 deletions
+11 -6
View File
@@ -266,6 +266,9 @@ def _run_push(cmd: list[str]) -> subprocess.CompletedProcess[str]:
BlobUploader.Append that causes intermittent HTTP 500 "offset
mismatch" errors during concurrent blob uploads. Retrying the
push gives the registry time to recover.
Docker sends push progress/errors to both stdout and stderr depending
on the error type, so both streams are checked for the 500 status.
"""
result = subprocess.run( # nosec B603
cmd,
@@ -273,8 +276,10 @@ def _run_push(cmd: list[str]) -> subprocess.CompletedProcess[str]:
text=True,
check=False,
)
if result.returncode != 0 and "500" in result.stderr:
raise PushHTTP500Error(result.stderr.strip())
if result.returncode != 0:
combined = f"{result.stderr}\n{result.stdout}"
if "500" in combined:
raise PushHTTP500Error(combined.strip())
return result
@@ -329,10 +334,10 @@ def push_image(
if result.returncode == 0:
click.echo(f"Pushed {ft}")
continue
stderr = result.stderr.strip()
combined_output = f"{result.stderr}\n{result.stdout}".strip()
# Gitea #31964: push fails because tag already exists.
# Delete the old manifest and retry once.
if username and token and "already exists" in stderr.lower():
if username and token and "already exists" in combined_output.lower():
click.echo(" Tag exists (Gitea #31964), deleting old manifest and retrying...")
delete_remote_manifest(
registry,
@@ -352,9 +357,9 @@ def push_image(
if result.returncode == 0:
click.echo(f"Pushed {ft} (after retry)")
continue
stderr = result.stderr.strip()
combined_output = f"{result.stderr}\n{result.stdout}".strip()
click.echo(
_("Push failed for {tag}: {error}", tag=ft, error=stderr),
_("Push failed for {tag}: {error}", tag=ft, error=combined_output),
err=True,
)
all_ok = False