Merge pull request #45514 from laurazard/cherry-pick-dangling-history

[24.0 backport] c8d: image history – handle dangling images
This commit is contained in:
Sebastiaan van Stijn 2023-05-10 21:29:20 +02:00 committed by GitHub
commit ce79cd19f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,13 +90,16 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*imaget
return nil, err
}
tags := make([]string, len(tagged))
for i, t := range tagged {
var tags []string
for _, t := range tagged {
if isDanglingImage(t) {
continue
}
name, err := reference.ParseNamed(t.Name)
if err != nil {
return nil, err
}
tags[i] = reference.FamiliarString(name)
tags = append(tags, reference.FamiliarString(name))
}
history[0].Tags = tags
}