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

Fix kind image names with --bare #1027

Merged
merged 1 commit into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/commands/resolver.go
Expand Up @@ -199,7 +199,7 @@ func makePublisher(po *options.PublishOptions) (publish.Interface, error) {
)
}
if strings.HasPrefix(repoName, publish.KindDomain) {
return publish.NewKindPublisher(namer, po.Tags), nil
return publish.NewKindPublisher(repoName, namer, po.Tags), nil
}

if repoName == "" && po.Push {
Expand Down
8 changes: 5 additions & 3 deletions pkg/publish/kind.go
Expand Up @@ -33,13 +33,15 @@ const (
)

type kindPublisher struct {
base string
namer Namer
tags []string
}

// NewKindPublisher returns a new publish.Interface that loads images into kind nodes.
func NewKindPublisher(namer Namer, tags []string) Interface {
func NewKindPublisher(base string, namer Namer, tags []string) Interface {
return &kindPublisher{
base: base,
namer: namer,
tags: tags,
}
Expand Down Expand Up @@ -96,7 +98,7 @@ func (t *kindPublisher) Publish(ctx context.Context, br build.Result, s string)
return nil, err
}

digestTag, err := name.NewTag(fmt.Sprintf("%s:%s", t.namer(KindDomain, s), h.Hex))
digestTag, err := name.NewTag(fmt.Sprintf("%s:%s", t.namer(t.base, s), h.Hex))
if err != nil {
return nil, err
}
Expand All @@ -109,7 +111,7 @@ func (t *kindPublisher) Publish(ctx context.Context, br build.Result, s string)

for _, tagName := range t.tags {
log.Printf("Adding tag %v", tagName)
tag, err := name.NewTag(fmt.Sprintf("%s:%s", t.namer(KindDomain, s), tagName))
tag, err := name.NewTag(fmt.Sprintf("%s:%s", t.namer(t.base, s), tagName))
if err != nil {
return nil, err
}
Expand Down