DEVX-163: fix: use stderr=STDOUT to capture all docker push output in one stream
Post-merge / detect-and-configure (push) Successful in 13s
Post-merge / release-and-maintain (push) Successful in 1m18s

This commit was merged in pull request #309.
This commit is contained in:
2026-08-26 14:09:59 +00:00
parent a7cdebc0dc
commit 149e8846b8
2 changed files with 30 additions and 40 deletions
+11 -8
View File
@@ -269,17 +269,19 @@ def _run_push(cmd: list[str]) -> subprocess.CompletedProcess[str]:
Docker sends push progress/errors to both stdout and stderr depending
on the error type, so both streams are checked for the 500 status.
Uses stderr=STDOUT to merge both streams into stdout, ensuring all
output is captured in one place (docker push output behavior varies
depending on TTY detection).
"""
result = subprocess.run( # nosec B603
cmd,
capture_output=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
check=False,
)
if result.returncode != 0:
combined = f"{result.stderr}\n{result.stdout}"
if "500" in combined:
raise PushHTTP500Error(combined.strip())
if result.returncode != 0 and "500" in (result.stdout or ""):
raise PushHTTP500Error(result.stdout.strip())
return result
@@ -334,7 +336,7 @@ def push_image(
if result.returncode == 0:
click.echo(f"Pushed {ft}")
continue
combined_output = f"{result.stderr}\n{result.stdout}".strip()
combined_output = (result.stdout or "").strip()
# Gitea #31964: push fails because tag already exists.
# Delete the old manifest and retry once.
if username and token and "already exists" in combined_output.lower():
@@ -350,14 +352,15 @@ def push_image(
click.echo(f" Retrying push {ft}...")
result = subprocess.run( # nosec B603
cmd,
capture_output=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
check=False,
)
if result.returncode == 0:
click.echo(f"Pushed {ft} (after retry)")
continue
combined_output = f"{result.stderr}\n{result.stdout}".strip()
combined_output = (result.stdout or "").strip()
click.echo(
_("Push failed for {tag}: {error}", tag=ft, error=combined_output),
err=True,