Merge pull request #46719 from rumpl/c8d-image-created-date

c8d: show the real image creation date when listing images
This commit is contained in:
Djordje Lukic 2023-10-25 17:38:01 +02:00 committed by GitHub
commit 7d5445e312
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,9 @@ import (
// Subset of ocispec.Image that only contains Labels
type configLabels struct {
// Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
Created *time.Time `json:"created,omitempty"`
Config struct {
Labels map[string]string `json:"Labels,omitempty"`
} `json:"config,omitempty"`
@ -277,9 +280,8 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
}
summary := &imagetypes.Summary{
ParentID: "",
ParentID: rawImg.Labels[imageLabelClassicBuilderParent],
ID: target.String(),
Created: rawImg.CreatedAt.Unix(),
RepoDigests: repoDigests,
RepoTags: repoTags,
Size: totalSize,
@ -291,6 +293,9 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
SharedSize: -1,
Containers: -1,
}
if cfg.Created != nil {
summary.Created = cfg.Created.Unix()
}
if opts.ContainerCount {
// Get container count