Add JSON output to cog push - #3178
Conversation
Cog push can now emit one versioned JSON document containing immutable image, model, and managed-weight references after the full push and provider workflow succeeds. Progress and diagnostics remain on stderr, while failures leave stdout empty.\n\nA positional target now works for both image and bundle projects, overrides configured and environment destinations, rejects digest destinations, and keeps managed weights in their imported repository. Existing human-readable pushes retain their prior output and digest fallback.
Explain how positional targets interact with image and bundle projects, configured destinations, tags, and managed weights. The deployment guide now defines the versioned JSON schema, immutable-reference guarantees, output streams, and failure behavior for automation.\n\nRegenerate the CLI reference and llms index from the updated command help and documentation.
Carry the digest reported by each Docker push implementation into image and bundle results instead of resolving a mutable tag after upload. Concurrent pushes to the same tag can no longer make one command report or package another command's image.\n\nBundle output now follows cog.yaml weight order and positional bundle tags receive the same validation as configured tags. Registry tests cover image and bundle JSON output, weight counts and ordering, target forms, human output, and empty stdout across failure paths.
Include the generated PushResultCommand mock introduced by digest-aware image pushes. The checked-in mock output now matches the interfaces in pkg/docker/command and can be reproduced by the repository's generator.
There was a problem hiding this comment.
Review summary
Adds cog push <target> --json for image and bundle projects. Output is one versioned, digest-pinned JSON document on stdout, with progress/warnings on stderr; bundle pushes now use the upload-reported manifest digest instead of HEADing the tag.
Overall this is well-designed and thoroughly tested: digest-pinned refs are validated before emitting JSON, the destination/format resolution is unified so the CLI and Resolver can't disagree on a timestamp tag, weights are ordered by config, and progress stays off stdout. I ran the Go build, go vet, and the pkg/cli, pkg/model, and pkg/docker test suites — all pass.
One finding below (bundle push digest hard-requirement), plus a couple of informational notes.
Informational (not blocking):
- This is a deliberate, documented behavior change: positional targets are now accepted for
model:projects (previously rejected), and a positional target now also bypasses theimage:+COG_MODEL*conflict. Docs/tests cover it, but scripts that relied on the old error will now get a bundle push to the given destination. MockPushResultCommand2inpkg/docker/dockertest/command_mocks.gois generated but unused.docs/deploy.mdsays "Non-JSON pushes keep their existing fallback when a registry can't resolve the pushed image's digest" — this is only true for the image path; bundle pushes always require the digest.
|
I'm Bonk, and I've done a quick review of your PR. Adds Findings (1 inline suggestion submitted):
Informational (not blocking): positional targets are now accepted for Verified: |
Move rustls to 0.23.45, which rejects TLS 1.3 handshake messages received at the wrong encryption level and resolves RUSTSEC-2026-0285. Cargo also updates rustls-webpki and unifies compatible windows-sys lockfile entries.
|
LGTM |
When Docker completes a bundle image push without reporting its manifest digest, human-readable pushes now fall back to the previous tag-based descriptor lookup. JSON output remains strict so it never trusts a mutable tag when producing immutable references.\n\nNarrow the fallback documentation to image-format pushes and cover both permissive and strict bundle behavior.
Exercise the non-JSON bundle fallback when a Docker command doesn't expose push results, not only when it returns an empty digest. Keep the new failure-path assertions within the repository's Testify conventions.
|
@michaeldwan Bonk workflow was cancelled. View workflow run · To retry, trigger Bonk again. |
|
LGTM |
Adds
cog push <target> --jsonfor image and bundle projects. The output contains digest-pinned image, model, and managed-weight references while progress stays on stderr.