Skip to content

add bulk image push CLI#728

Open
rasdani wants to merge 5 commits into
mainfrom
codex/bulk-image-push
Open

add bulk image push CLI#728
rasdani wants to merge 5 commits into
mainfrom
codex/bulk-image-push

Conversation

@rasdani

@rasdani rasdani commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add prime images push-batch as a first CLI draft for bulk image builds.
  • Default input mode reads JSONL rows with id/task_id plus raw dockerfile text, generates deterministic short tags, and assembles a batch manifest/payload.
  • Add Harbor scanner mode for immediate task directories using each task's environment/ directory as the build context while excluding tests/ and solution/ from uploaded contexts.
  • Share build-context packaging/upload helpers with the existing single-image prime images push path.

Backend assumptions

This CLI targets a proposed future backend resource: POST /images/build-batches, optional per-item context uploads from the response, then POST /images/build-batches/{batch_id}/start. The current platform endpoint is assumed/not yet implemented, so this PR focuses on client-side validation, manifest generation, request payload assembly, and mocked tests.

Deferred

Docker compose task support is intentionally deferred. Harbor mode detects compose files (docker-compose.yaml, docker-compose.yml, compose.yaml, compose.yml) and fails clearly by default, with --skip-unsupported-compose available to continue with Dockerfile-only tasks.

Validation

  • uv run pytest packages/prime/tests/test_images_push.py -q
  • uv run ruff check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.py
  • uv run ruff format --check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.py
  • uv run ty check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.py
  • uv run prime images push-batch --help
  • git diff --check

Note

Medium Risk
Large new client surface targets an unimplemented backend API; Harbor uploads and resume paths affect many images per run, though behavior is covered by CLI tests and does not change server auth.

Overview
Adds bulk image build support to the Prime CLI via prime images push-batch, plus batch-status, batch-cancel, and batch-retry against the proposed /images/build-batches API.

push-batch accepts either JSONL rows (inline Dockerfile text, deterministic tags from --tag-template) or a Harbor task tree (environment/ contexts, excluding tests/ and solution/). Harbor docker-compose tasks fail by default or can be skipped with --skip-unsupported-compose. The flow creates a batch, optionally uploads context archives in parallel (with retries and --resume), then starts the batch; --dry-run and --manifest-output support validation without calling the backend.

prime images push is refactored to share helpers for path validation, .dockerignore-aware context packaging, and context upload (including longer batch API timeouts).

Reviewed by Cursor Bugbot for commit 99e1add. Bugbot is set up for automated code reviews on this repo. Configure here.

@rasdani rasdani changed the title [codex] add draft bulk image push CLI sketch: add draft bulk image push CLI Jun 7, 2026
@rasdani rasdani changed the title sketch: add draft bulk image push CLI protoype add draft bulk image push CLI Jun 7, 2026
@rasdani rasdani changed the title protoype add draft bulk image push CLI protoype: add draft bulk image push CLI Jun 7, 2026
@rasdani rasdani changed the title protoype: add draft bulk image push CLI do-not-merge: add draft bulk image push CLI Jun 7, 2026
@kcoopermiller kcoopermiller changed the title do-not-merge: add draft bulk image push CLI add bulk image push CLI Jun 9, 2026
@kcoopermiller kcoopermiller marked this pull request as ready for review June 9, 2026 06:27

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 99e1add. Configure here.

# exits promptly instead of draining the rest of the batch.
cancel_event.set()
pool.shutdown(wait=False, cancel_futures=True)
raise

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thread pool waits after Ctrl-C

Medium Severity

In _upload_batch_contexts, a KeyboardInterrupt handler calls pool.shutdown(wait=False, cancel_futures=True) so Harbor batch uploads stop quickly, but the surrounding with ThreadPoolExecutor(...) still runs __exit__, which calls shutdown(wait=True) and can block until in-flight httpx.put uploads finish.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 99e1add. Configure here.

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.

2 participants