Skip to content

Extract build polling and share between bk build watch and bk preflight#714

Draft
matthewborden wants to merge 5 commits intomainfrom
preflight-poll
Draft

Extract build polling and share between bk build watch and bk preflight#714
matthewborden wants to merge 5 commits intomainfrom
preflight-poll

Conversation

@matthewborden
Copy link
Contributor

@matthewborden matthewborden commented Mar 24, 2026

This extracts the build polling loop from bk build watch into a shared internal/build/watch package and reuses it in bk preflight.

Previously bk build watch had its own inline polling loop with no error tolerance, and bk preflight would create the build and exit immediately. With this change:

  • bk preflight now watches the build until completion by default (--no-watch to disable)
  • Both commands share the same polling logic with retry tolerance (10 consecutive API errors before aborting) and per-request timeouts
  • The preflight summary covers all job states:
Summary Job States
passed passed
failed failed, timed_out
canceled canceled
running running, canceling, timing_out
scheduled scheduled, assigned, accepted, reserved
blocked blocked, blocked_failed
skipped skipped, broken
waiting waiting, waiting_failed, pending, limited, limiting, platform_limited, platform_limiting, expired

Unknown states, and non-command jobs are ignored.

Verification

  1. Run bk build watch -p <pipeline> and confirm it behaves as before.
  2. Run bk preflight -p <pipeline> and confirm it polls and prints job state updates until the build finishes.
  3. Run bk preflight -p <pipeline> --no-watch and confirm it exits after creating the build.
  4. mise run test

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