The pinning line shows the built image's id, not one digit of it

This commit is contained in:
2026-09-21 15:27:13 +02:00
parent 5223169226
commit 8afbe57814
+11 -1
View File
@@ -79,7 +79,7 @@ func InstallControlPlane(ctx context.Context, o Options, d Deps, control control
if err != nil { if err != nil {
return out, err return out, err
} }
say(fmt.Sprintf(" pinned %s → %s, in %d place(s)", shortRef(built.Image), image, places)) say(fmt.Sprintf(" pinned %s → %s, in %d place(s)", shortImage(built.Image), image, places))
container, _, err := containerIn(pinned, controlPlaneResourceIn(pinned)) container, _, err := containerIn(pinned, controlPlaneResourceIn(pinned))
if err != nil { if err != nil {
@@ -398,3 +398,13 @@ func sortedKeys(m map[string]string) []string {
sort.Strings(keys) sort.Strings(keys)
return keys return keys
} }
// shortImage is an image id as a person reads one: the first twelve hex digits, without the
// algorithm in front — `shortRef` would keep the prefix and show one digit of the digest.
func shortImage(id string) string {
digest := strings.TrimPrefix(id, "sha256:")
if len(digest) > 12 {
return digest[:12]
}
return digest
}