add bulk image push CLI#728
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 000575b. Configure here.
| """Upload packaged contexts in parallel over a single pooled HTTP client.""" | ||
| already_uploaded = set(already_uploaded or set()) | ||
| uploadable = [item for item in context_items if item.context_archive is not None] | ||
| pending = [item for item in uploadable if item.source_id not in already_uploaded] |
There was a problem hiding this comment.
Resume skips stale uploads
High Severity
On --resume, the local upload cache records only source_id values, and pending uploads are skipped when an id is already marked uploaded. The command still repackages contexts from the current source, so if a Dockerfile or Harbor environment changed between attempts, re-upload is skipped and the batch can start with outdated blobs while the CLI shows fresh tags/manifest data.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 000575b. Configure here.
| raise typer.Exit(1) | ||
| except APIError as exc: | ||
| console.print(f"[red]Error: Failed to refresh upload URLs: {exc}[/red]") | ||
| raise typer.Exit(1) from exc |
There was a problem hiding this comment.
Resume blocks start-only retry
Medium Severity
When resuming a batch, the CLI always calls POST .../upload-urls before it knows whether any contexts still need uploading. If every item is already in the local upload cache, a failure on that refresh call exits before POST .../start, even though no uploads are required to finish a batch whose contexts were uploaded on a prior run.
Reviewed by Cursor Bugbot for commit 000575b. Configure here.


Summary
prime images push-batchas a first CLI draft for bulk image builds.id/task_idplus rawdockerfiletext, generates deterministic short tags, and assembles a batch manifest/payload.environment/directory as the build context while excludingtests/andsolution/from uploaded contexts.prime images pushpath.Backend assumptions
This CLI targets a proposed future backend resource:
POST /images/build-batches, optional per-item context uploads from the response, thenPOST /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-composeavailable to continue with Dockerfile-only tasks.Validation
uv run pytest packages/prime/tests/test_images_push.py -quv run ruff check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.pyuv run ruff format --check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.pyuv run ty check packages/prime/src/prime_cli/commands/images.py packages/prime/tests/test_images_push.pyuv run prime images push-batch --helpgit diff --checkNote
Medium Risk
Large new client surface area and parallel uploads depend on a not-yet-implemented backend contract; Harbor mode intentionally omits
tests/andsolution/from contexts, which could surprise users if misconfigured.Overview
Adds
prime images push-batchto build many images against the proposedPOST /images/build-batchesAPI: validate inputs, assign deterministic tags via--tag-template, package per-item context tarballs, upload in parallel to presigned URLs, then start the batch. Supports dockerfile mode (JSONL with inline Dockerfile text) and harbor mode (scan task dirs, uploadenvironment/while excludingtests/andsolution/). Includes--dry-run,--manifest-output,--resumewith local upload progress cache, and mid-flight presigned URL refresh on 401/403.Also adds
batch-status,batch-cancel, andbatch-retryfor batch lifecycle management.prime images pushis refactored to share context packaging, dockerignore handling, visibility validation, and upload helpers with the batch path. Tests intest_images_push.pycover batch flows, harbor packaging, compose rejection, resume, and expired URLs.Reviewed by Cursor Bugbot for commit 000575b. Bugbot is set up for automated code reviews on this repo. Configure here.