Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/crane/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import (
"golang.org/x/sync/errgroup"
)

// ErrRefusingToClobberExistingTag is returned when NoClobber is true and the
// tag already exists in the target registry/repo.
var ErrRefusingToClobberExistingTag = errors.New("refusing to clobber existing tag")

// Copy copies a remote image or index from src to dst.
func Copy(src, dst string, opt ...Option) error {
o := makeOptions(opt...)
Expand Down Expand Up @@ -58,7 +62,7 @@ func Copy(src, dst string, opt ...Option) error {
}

if head != nil {
return fmt.Errorf("refusing to clobber existing tag %s@%s", tag, head.Digest)
return fmt.Errorf("%w %s@%s", ErrRefusingToClobberExistingTag, tag, head.Digest)
}
}
}
Expand Down