Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying a separate target reference to push in kit push #685

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amisevsk
Copy link
Contributor

Description

Allow specifying a separate push target, so that you don't have to tag ModelKits locally before pushing (similar to what podman--but not docker--does).

  • Push locally-tagged image to remote (same as what we currently do):
    kit push registry.example.com/myorg/mymodel:mytag
    
  • Push a local image to the same remote without tagging first
    kit push localmodel:latest registry.example.com/myorg/mymodel:mytag
    

Linked issues

I didn't create an issue for this one yet, but I figured it'd be useful while working on #684, which by default tags according to the HF repo

Add a two-argument version of `kit push` that allows pushing local
modelkits without explicitly tagging them first.

When specified with one argument, e.g.

  kit push example.com/myorg/myrepo:mytag

we'll push the locally-tagged ModelKit as before. When specified with
two arguments, e.g.

  kit push myorg/mymodel:mytag example.com/neworg/newrepo:newtag

we'll push the locally tagged model to the remote registry under a
differente repository
@amisevsk amisevsk requested a review from gorkem January 10, 2025 18:32
The modelkits should be tagged with the target registry and repository before
they can be pushed`
If specified without a destination, the ModelKit should be tagged locally before
pushing.`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it "must" be tagged otherwise push will fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, but I think the wording here is generally strange -- if you type kit push quay.io/myorg/mymodel:latest, what does that mean if you don't have a modelkit tagged quay.io/myorg/mymodel:latest?

}
if modelRef.Registry == "localhost" {
return fmt.Errorf("registry is required when pushing")
return fmt.Errorf("failed to parse reference %s: %w", args[0], err)
}
if len(extraTags) > 0 {
return fmt.Errorf("reference cannot include multiple tags")
Copy link
Contributor

Choose a reason for hiding this comment

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

now that there are 2 references, we should qualify this one as source reference similiar to the dest one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to complicate the wording too much (so we do distinguish them by labelling the target target). If specified with one argument, calling it the source reference doesn't make a lot of sense to me, as it's both the source and destination.

opts.destModelRef = destRef
}

if opts.destModelRef.Registry == "localhost" {
Copy link
Contributor

Choose a reason for hiding this comment

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

localhost is a valid use case in local testing. Is this making it impossible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope :)

This check has always been here -- it's because we adopted the podman convention of using localhost as the registry placeholder in references (so that they're still valid). Local usage isn't impacted, since you would likely tag your ModelKit localhost:5050, which doesn't match.

For context, we need a way to store and parse references to ModelKits that don't have full information, while the OCI spec requires both a registry and repository. For example, completely untagged ModelKits are represented localhost/_@<digest>.

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