Skip to content

feat: support packing and pushing directly to a remote registry#1243

Open
Hemanth-1354 wants to merge 1 commit into
kitops-ml:mainfrom
Hemanth-1354:feat/pack-push-remote
Open

feat: support packing and pushing directly to a remote registry#1243
Hemanth-1354 wants to merge 1 commit into
kitops-ml:mainfrom
Hemanth-1354:feat/pack-push-remote

Conversation

@Hemanth-1354

@Hemanth-1354 Hemanth-1354 commented Jul 9, 2026

Copy link
Copy Markdown

Description

Adds a --push flag to kit pack that streams the packed modelkit directly to
the remote registry specified by --tag, skipping local storage entirely.

Currently kit pack always writes layers/config/manifest to the local on-disk
cache 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, SaveModel and its layer
helpers write to a generic oras.Target instead of a concrete local repo, so
the same pack pipeline can target either local storage (default, unchanged
behavior) or a remote registry (remote.NewRepository) directly. Digests are
still computed via a temporary file (required to know the digest before
pushing), but nothing is persisted to the permanent local ModelKit cache when
--push is used.

Follows the approach agreed with @amisevsk in the issue thread (flag named
--push per that discussion).

Linked issues

Closes #1026

AI-Assisted Code

  • This PR contains AI-generated code that I have reviewed and tested
  • I take full responsibility for all code in this PR, regardless of how it was created

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>
@Hemanth-1354
Hemanth-1354 force-pushed the feat/pack-push-remote branch from 97dfc2a to b2e2b6b Compare July 9, 2026 05:44

@amisevsk amisevsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread pkg/cmd/pack/cmd.go
Comment on lines +169 to +176
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
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If push is false, we should print a warning that network flags are only applicable when --push is specified.

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.

Enable packing and pushing directly to remote without storing layers locally

2 participants