This commit is contained in:
Yves Brissaud 2024-11-18 17:27:50 +00:00 committed by GitHub
commit 54e475c64f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -51,6 +51,12 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
var totalContent int64
children := make([]subImage, 0, len(img.Manifests))
attestations := make(map[string]bool)
for _, im := range img.Manifests {
if im.Kind == imagetypes.ManifestKindAttestation {
attestations[im.AttestationData.For.String()] = true
}
}
for _, im := range img.Manifests {
if im.Kind != imagetypes.ManifestKindImage {
continue
@ -64,6 +70,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
DiskUsage: units.HumanSizeWithPrecision(float64(im.Size.Total), 3),
InUse: len(im.ImageData.Containers) > 0,
ContentSize: units.HumanSizeWithPrecision(float64(im.Size.Content), 3),
Attestation: attestations[im.ID],
},
}
@ -101,6 +108,7 @@ type imageDetails struct {
DiskUsage string
InUse bool
ContentSize string
Attestation bool
}
type topImage struct {
@ -161,6 +169,18 @@ func printImageTree(dockerCLI command.Cli, view treeView) error {
return stringid.TruncateID(d.ID)
},
},
{
Title: "Attest",
Align: alignLeft,
Width: 6,
Color: &greenColor,
DetailsValue: func(d *imageDetails) string {
if d.Attestation {
return "✔"
}
return " "
},
},
{
Title: "Disk usage",
Align: alignRight,