Skip to content

Add --retry option to bakery build command#384

Open
ianpittwood wants to merge 1 commit intomainfrom
build-retry
Open

Add --retry option to bakery build command#384
ianpittwood wants to merge 1 commit intomainfrom
build-retry

Conversation

@ianpittwood
Copy link
Contributor

Summary

  • Add --retry CLI option to bakery build command (default: 0 for CLI, 1 for CI workflows)
  • Add _retry_build() helper that retries transient failures (DockerException, BakeryToolRuntimeError) with 5-second delay
  • Fix os.chdir safety in BakePlan.build() to restore cwd on exception
  • Add comprehensive unit tests for retry functionality

Test plan

  • All 1176 existing tests pass
  • New retry tests in test_build_retry.py cover success, retry-then-success, exhausted retries, and BakeryFileError (never retried)
  • bakery build --help shows --retry option
  • Manual test with failing build to verify retry behavior

🤖 Generated with Claude Code

Add retry functionality to handle transient build failures like network
errors and registry rate limits. The --retry option specifies how many
times to retry failed builds with a 5-second delay between attempts.
BakeryFileError is never retried as missing files won't self-heal.

Also fixes os.chdir safety in BakePlan.build() to restore cwd on exception.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ianpittwood ianpittwood requested a review from bschwedler as a code owner March 12, 2026 20:37
@github-actions
Copy link

Test Results

1 202 tests  +8   1 202 ✅ +8   13m 15s ⏱️ +5s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 7e2e05f. ± Comparison against base commit ecb29f7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant