Skip to content

Commit c27194b

Browse files
authored
Show digest of pushed images (#1737)
* Show digest of pushed images * Non-fatal log * Make easier to copy and paste
1 parent b74ef7f commit c27194b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

container/go/cmd/pusher/pusher.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,21 @@ func main() {
121121
log.Printf("Destination %s was resolved to %s after stamping.", *dst, stamped)
122122
}
123123

124+
digest, err := img.Digest()
125+
if err != nil {
126+
log.Printf("Failed to digest image: %v", err)
127+
}
128+
124129
if err := push(stamped, img); err != nil {
125130
log.Fatalf("Error pushing image to %s: %v", stamped, err)
126131
}
127132

128-
log.Printf("Successfully pushed %s image to %s", *format, stamped)
133+
digestStr := ""
134+
if !strings.Contains(stamped, "@") {
135+
digestStr = fmt.Sprintf(" - %s@%s", strings.Split(stamped, ":")[0], digest)
136+
}
137+
138+
log.Printf("Successfully pushed %s image to %s%s", *format, stamped, digestStr)
129139
}
130140

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

0 commit comments

Comments
 (0)