Skip to content

Commit

Permalink
fix(ko): Display correct tag
Browse files Browse the repository at this point in the history
Display the expected tag after successfully building a ko image, for
both sideloaded and published images.

Also handles the `tagPolicy.sha256` scenarios.

Fixes: GoogleContainerTools#6835
Tracking: GoogleContainerTools#6041
  • Loading branch information
halvards committed Nov 11, 2021
1 parent a9d7152 commit b0da432
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/skaffold/build/ko/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ func (b *Builder) Build(ctx context.Context, out io.Writer, a *latestV1.Artifact
if err != nil {
return "", fmt.Errorf("could not build and publish ko image %q: %w", a.ImageName, err)
}
fmt.Fprintln(out, imageRef.Name())

outputRef := ref
if strings.HasSuffix(ref, ":latest") {
// handle tagPolicy sha256
outputRef = imageRef.Name()
}
fmt.Fprintln(out, outputRef)

return b.getImageIdentifier(ctx, imageRef, ref)
}
Expand Down

0 comments on commit b0da432

Please sign in to comment.