Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c8d: show the real image creation date when listing images #46719

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Oct 25, 2023

- What I did

Used the creation date of the imge from the config and not from the containerd metadata,

$ docker pull busybox
$ docker images      
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
-busybox      latest    3fbc63216742   20 seconds ago   6.61MB
+busybox      latest    3fbc63216742   3 months ago   6.61MB

Also set the ParentID to whatever we find in the image labels

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@@ -276,10 +279,15 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
return nil, nil, err
}

created := int64(0)
if cfg.Created != nil {
created = cfg.Created.Unix()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Micro-nit; as we already have a summary var in which we store the image-data, I guess we can avoid the created var if we put this block after it;

if cfg.Created != nil {
    summary.Created = cfg.Created.Unix()
}

Would there be a need to do && !cfg.Created.IsZero() as well? (not sure)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to set the Created in the IsZero case, that's actually what the GD case does

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huhu, want me to change this one too while I'm at it?

if image.Created != nil {
created = image.Created.Unix()
}
summary := &imagetypes.Summary{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! We can; but that's fine for a separate PR, as that's not a new change, right?

My comment was mostly; if we want to; let's do so before merging, to reduce (ever so little) code churn 👍

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@thaJeztah thaJeztah added status/2-code-review area/images containerd-integration Issues and PRs related to containerd integration labels Oct 25, 2023
@thaJeztah thaJeztah added this to the 25.0.0 milestone Oct 25, 2023
@rumpl rumpl force-pushed the c8d-image-created-date branch from 37ef049 to 8f756fe Compare October 25, 2023 14:50
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rumpl rumpl merged commit 7d5445e into moby:master Oct 25, 2023
118 of 136 checks passed
@rumpl rumpl deleted the c8d-image-created-date branch October 25, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/images containerd-integration Issues and PRs related to containerd integration status/2-code-review
Projects
Development

Successfully merging this pull request may close these issues.

3 participants