feat: support packing and pushing directly to a remote registry#1243
feat: support packing and pushing directly to a remote registry#1243Hemanth-1354 wants to merge 1 commit into
Conversation
Add a --push flag to `kit pack` that streams the packed modelkit straight to the tagged remote registry, skipping local storage entirely. SaveModel and its layer/config helpers now operate on a generic oras.Target instead of a concrete local.LocalRepo, so the same pack pipeline can write to either local storage or a remote registry. Closes kitops-ml#1026 Signed-off-by: Hemanth-1354 <hemanthkumarpolisetti@gmail.com>
97dfc2a to
b2e2b6b
Compare
amisevsk
left a comment
There was a problem hiding this comment.
Thanks @Hemanth-1354. I have a couple of minor comments, but otherwise this looks generally good. If you drop the changes to cli-reference.md and add the warning log on flags, this looks good to merge.
This doesn't fully hit what I was thinking for the issue, but is a great improvement nonetheless. A future (and significantly more complicated) improvement would be to do the push without storing the intermediate file on disk -- the tar writer could write directly into a remote connection and send the digest to seal the upload.
There was a problem hiding this comment.
Please revert changes to cli-reference.md -- this file is automatically regenerated from CLI help pages when a new release is generated.
Otherwise, this documentation appears on https://kitops.org/docs/cli/cli-reference/ before the flags are actually available in a release.
| if opts.push { | ||
| if opts.modelRef.Registry == artifact.DefaultRegistry { | ||
| return fmt.Errorf("--push requires a remote registry to be specified with --tag") | ||
| } | ||
| if err := opts.NetworkOptions.Complete(ctx, args); err != nil { | ||
| return err | ||
| } | ||
| } |
There was a problem hiding this comment.
If push is false, we should print a warning that network flags are only applicable when --push is specified.
Description
Adds a
--pushflag tokit packthat streams the packed modelkit directly tothe remote registry specified by
--tag, skipping local storage entirely.Currently
kit packalways writes layers/config/manifest to the local on-diskcache before an optional separate
kit push, meaning a model is stored twice(source directory + local cache) before ever reaching the registry — costly in
CI environments where disk is limited. With
--push,SaveModeland its layerhelpers write to a generic
oras.Targetinstead of a concrete local repo, sothe same pack pipeline can target either local storage (default, unchanged
behavior) or a remote registry (
remote.NewRepository) directly. Digests arestill computed via a temporary file (required to know the digest before
pushing), but nothing is persisted to the permanent local ModelKit cache when
--pushis used.Follows the approach agreed with @amisevsk in the issue thread (flag named
--pushper that discussion).Linked issues
Closes #1026
AI-Assisted Code