Merge pull request #4065 from vvoland/dangling-images-none-23

[23.0 backport] formatter: Consider empty RepoTags and RepoDigests as dangling
This commit is contained in:
Sebastiaan van Stijn 2023-03-02 14:31:31 +01:00 committed by GitHub
commit 92164b0306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -27,6 +27,9 @@ type ImageContext struct {
} }
func isDangling(image types.ImageSummary) bool { func isDangling(image types.ImageSummary) bool {
if len(image.RepoTags) == 0 && len(image.RepoDigests) == 0 {
return true
}
return len(image.RepoTags) == 1 && image.RepoTags[0] == "<none>:<none>" && len(image.RepoDigests) == 1 && image.RepoDigests[0] == "<none>@<none>" return len(image.RepoTags) == 1 && image.RepoTags[0] == "<none>:<none>" && len(image.RepoDigests) == 1 && image.RepoDigests[0] == "<none>@<none>"
} }