Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Show digest of pushed images #1737

Merged
merged 3 commits into from
Jan 24, 2022
Merged
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
12 changes: 11 additions & 1 deletion container/go/cmd/pusher/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,21 @@ func main() {
log.Printf("Destination %s was resolved to %s after stamping.", *dst, stamped)
}

digest, err := img.Digest()
if err != nil {
log.Printf("Failed to digest image: %v", err)
}

if err := push(stamped, img); err != nil {
log.Fatalf("Error pushing image to %s: %v", stamped, err)
}

log.Printf("Successfully pushed %s image to %s", *format, stamped)
digestStr := ""
if !strings.Contains(stamped, "@") {
digestStr = fmt.Sprintf(" - %s@%s", strings.Split(stamped, ":")[0], digest)
}

log.Printf("Successfully pushed %s image to %s%s", *format, stamped, digestStr)
}

// digestExists checks whether an image's digest exists in a repository.
Expand Down