Skip to content

fix: wrap docker buildx ls/create failures as ImageBuildError#1167

Open
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-4r-buildx-create
Open

fix: wrap docker buildx ls/create failures as ImageBuildError#1167
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-4r-buildx-create

Conversation

@EngHabu

@EngHabu EngHabu commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Problem

DockerImageBuilder._ensure_buildx_builder runs docker buildx ls and docker buildx create --name flytex ... with check=True. When either command fails, the resulting subprocess.CalledProcessError bubbled out raw and was reported to Sentry as an SDK crash — FLYTE-SDK-4R (CalledProcessError: Command '['docker', 'buildx', 'create', ...]' returned non-zero exit status 1).

These failures are local Docker-environment problems (daemon not running, BuildKit driver unavailable, or a leftover/locked flytex builder), not SDK bugs.

Fix

  • Wrap the docker buildx ls and docker buildx create calls in ImageBuildError (a RuntimeUserError, which _sentry.py already filters out) with an actionable message that includes the captured stderr and points the user at docker buildx rm flytex or the remote image builder (image_builder='remote').
  • If create fails because the builder already exists (e.g. a concurrent build created it between our ls check and the create), reuse it instead of failing.

This mirrors the existing wrapping already done for docker buildx version and the dockerfile build step.

Tests

Added three tests covering: create failure → ImageBuildError, ls failure → ImageBuildError, and already exists → reuse (no raise). All buildx tests pass.

fixes FLYTE-SDK-4R

@EngHabu EngHabu added the sentry-fix Fix for an issue surfaced by Sentry label Jun 5, 2026
@EngHabu EngHabu force-pushed the fix/sentry-4r-buildx-create branch from 3016130 to 5e99112 Compare June 6, 2026 16:06
@EngHabu EngHabu force-pushed the fix/sentry-4r-buildx-create branch 4 times, most recently from ef782be to ff04508 Compare June 11, 2026 16:11

@EngHabu EngHabu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EngHabu EngHabu requested a review from pingsutw June 11, 2026 19:37
@EngHabu EngHabu enabled auto-merge (squash) June 11, 2026 19:38
@EngHabu EngHabu force-pushed the fix/sentry-4r-buildx-create branch from ff04508 to eff1b92 Compare June 12, 2026 16:09
`docker buildx create --name flytex ...` (and `docker buildx ls`) run with
`check=True`, so a CalledProcessError bubbled out of `_ensure_buildx_builder`
raw and was reported to Sentry as an SDK crash (FLYTE-SDK-4R) even though the
failure is a local Docker environment problem (daemon down, driver missing, or
a leftover/locked builder), not an SDK bug.

Wrap both subprocess calls in `ImageBuildError` (a `RuntimeUserError`, filtered
from Sentry) with an actionable message that includes the captured stderr and
points at `docker buildx rm flytex` / the remote image builder. If the create
fails because the builder already exists (concurrent build), reuse it instead
of failing.

fixes FLYTE-SDK-4R

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@EngHabu EngHabu force-pushed the fix/sentry-4r-buildx-create branch from eff1b92 to d324e64 Compare June 13, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sentry-fix Fix for an issue surfaced by Sentry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant