Skip to content

Commit

Permalink
Reorder parsing KO_DOCKER_REPO to get proper credentials (#117)
Browse files Browse the repository at this point in the history
Fixes #93

With this change we support also pointing to default registry (without prefix).
Eg. KO_DOCKER_REPO=myuser
  • Loading branch information
cezkuj authored and jonjohnsonjr committed Dec 18, 2019
1 parent d24b60a commit 1fcfe62
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/publish/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ func WithAuthFromKeychain(keys authn.Keychain) Option {
// means that docker.io/mattmoor actually gets interpreted as
// docker.io/library/mattmoor, which gets tricky when we start
// appending things to it in the publisher.
reg, err := name.NewRegistry(i.base)
repo, err := name.NewRepository(i.base)
if err != nil {
// Workaround for localhost:5000 as KO_DOCKER_REPO.
repo, err := name.NewRepository(i.base)
reg, err := name.NewRegistry(i.base)
if err != nil {
return err
}
reg = repo.Registry
repo = name.Repository{Registry: reg}
}
auth, err := keys.Resolve(reg)
auth, err := keys.Resolve(repo.Registry)
if err != nil {
return err
}
Expand Down

0 comments on commit 1fcfe62

Please sign in to comment.