The pinning line shows the built image's id, not one digit of it
This commit is contained in:
@@ -79,7 +79,7 @@ func InstallControlPlane(ctx context.Context, o Options, d Deps, control control
|
||||
if err != nil {
|
||||
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))
|
||||
if err != nil {
|
||||
@@ -398,3 +398,13 @@ func sortedKeys(m map[string]string) []string {
|
||||
sort.Strings(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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user