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

Can we combine ko.local and --bare ? #807

Closed
eddycharly opened this issue Aug 29, 2022 · 7 comments · Fixed by #820
Closed

Can we combine ko.local and --bare ? #807

eddycharly opened this issue Aug 29, 2022 · 7 comments · Fixed by #820
Assignees

Comments

@eddycharly
Copy link

Is this possible to combine ko.local with --bare options to produce an image in the form ko.local/something ?
It looks like setting KO_DOCKER_REPO=ko.local/something produces an image with the name ko.local.

@imjasonh
Copy link
Member

v0.12 fixed a bug with KO_DOCKER_REPO=ko.local/foo which might be what you're describing.

That should work and if not it's a bug we should fix

@eddycharly
Copy link
Author

eddycharly commented Aug 30, 2022

Looks like it’s a bug, I’m using 0.12.
I’ll try again later today to be sure.

@imjasonh
Copy link
Member

imjasonh commented Sep 7, 2022

I've confirmed this behavior, and I believe it's a bug:

$ ko version
0.12.0
$ KO_DOCKER_REPO=ko.local/test ko build --bare
...
ko.local:b892c8419de3e2b9729a50707a75ba8643fe56c704bfe5625dcc7c19f1741c5f

This should be ko.local/test:b89...

@imjasonh imjasonh self-assigned this Sep 7, 2022
@eddycharly
Copy link
Author

Thanks for confirming the bug @imjasonh

@eddycharly
Copy link
Author

@imjasonh can this come from this

LocalDomain string
never being assigned ?

@imjasonh
Copy link
Member

LocalDomain is used by clients that use ko as a library (e.g., Skaffold), so it's not set by ko itself, and defaults to ko.local.

Support for KO_DOCKER_REPO=ko.local/foo is actually very new, prior to #796 we didn't support it at all -- only KO_DOCKER_REPO=ko.local exactly.

There seem to be a few lingering places where code assumes local images will be pushed to exactly ko.local:

if ref.Context().RegistryStr() == publish.LocalDomain {

(for local base images, unrelated to this issue)

It looks like the issue is here:

base: LocalDomain,

NewDaemon is called when strings.HasPrefix(KO_DOCKER_REPO, LocalDomain), here:

return publish.NewDaemon(namer, po.Tags,

...but then NewDaemon just sets LocalDomain only, without any local repo component.

I've got a fix I'll send out shortly.

@eddycharly
Copy link
Author

Thanks for looking at it @imjasonh !
This line looked suspicious

publish.WithLocalDomain(po.LocalDomain),
and made me suspect LocalDomain was guilty.

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 a pull request may close this issue.

2 participants