fix: wrap docker buildx ls/create failures as ImageBuildError#1167
Open
EngHabu wants to merge 1 commit into
Open
fix: wrap docker buildx ls/create failures as ImageBuildError#1167EngHabu wants to merge 1 commit into
EngHabu wants to merge 1 commit into
Conversation
3016130 to
5e99112
Compare
ef782be to
ff04508
Compare
ff04508 to
eff1b92
Compare
`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>
eff1b92 to
d324e64
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DockerImageBuilder._ensure_buildx_builderrunsdocker buildx lsanddocker buildx create --name flytex ...withcheck=True. When either command fails, the resultingsubprocess.CalledProcessErrorbubbled 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
flytexbuilder), not SDK bugs.Fix
docker buildx lsanddocker buildx createcalls inImageBuildError(aRuntimeUserError, which_sentry.pyalready filters out) with an actionable message that includes the capturedstderrand points the user atdocker buildx rm flytexor the remote image builder (image_builder='remote').createfails because the builder already exists (e.g. a concurrent build created it between ourlscheck and thecreate), reuse it instead of failing.This mirrors the existing wrapping already done for
docker buildx versionand the dockerfile build step.Tests
Added three tests covering: create failure →
ImageBuildError,lsfailure →ImageBuildError, andalready exists→ reuse (no raise). All buildx tests pass.fixes FLYTE-SDK-4R