Add a LastTagTime for images#31497
Conversation
|
I'm not sure about this; my worry is that there's no relation whatsoever with the actual image. This keeps track of when the build command is last executed, but not when the image is last updated, which seems completely separate. Take the following example; $ docker build -t foo -<<EOF
FROM busybox
RUN date > /lastupdated
EOF
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM busybox
---> 7968321274dc
Step 2/2 : RUN date > /lastupdated
---> Running in 256bcc697e92
---> a678cb68731c
Removing intermediate container 256bcc697e92
Successfully built a678cb68731cInspecting the image; Building the image again will use the cache, so no image is built; $ docker build -t foo -<<EOF
FROM busybox
RUN date > /lastupdated
EOF
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM busybox
---> 7968321274dc
Step 2/2 : RUN date > /lastupdated
---> Using cache
---> a678cb68731c
Successfully built a678cb68731cBut If we go this direction, I would also prefer that the "metadata" that's separate from the actual image would be in a separate "struct" in the inspect output. Perhaps we want to add more metadata that's independent from the image (the lengthy discussions about labels that can be set without altering the actual image) |
True, so I guess I need to either:
I prefer the second. What do you think?
That seems reasonable, |
12c5c90 to
1cfa5a9
Compare
|
If this is about the last time it was tagged, maybe we shouldn't call it |
1cfa5a9 to
bd6f431
Compare
|
Changed it to |
@dnephin did you have a look at making that change? I think others agreed on this when we were discussing |
bd6f431 to
8dc6e2d
Compare
|
I've made that change |
8dc6e2d to
c6ee84f
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
design LGTM, but left a question
There was a problem hiding this comment.
should this have omitempty? Also wondering why it's not using time.Time (as we use in other places), e.g.;
UpdatedAt time.Time `json:",omitempty"`
There was a problem hiding this comment.
Added omitempty and changed to time.Time.
c6ee84f to
6ff363f
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM, only forgot about the API changelog; can you add a mention here; https://github.com/docker/docker/blob/master/docs/api/version-history.md
|
ping @tiborvass PTAL |
6ff363f to
8c0f64a
Compare
|
Needs a rebase, but LGTM. |
8c0f64a to
8d61245
Compare
8d61245 to
0496029
Compare
|
I rebased (because it was only the api-chances), but looks like it needed more changes due to 3aa4a00#diff-1ed32f2ce4c90e536bbbb9ede729120c (#33241) being merged; these are the changes I added; diff --git a/daemon/image_inspect.go b/daemon/image_inspect.go
index a2b1d59..3baf265 100644
--- a/daemon/image_inspect.go
+++ b/daemon/image_inspect.go
@@ -61,7 +61,7 @@ func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) {
comment = img.History[len(img.History)-1].Comment
}
- lastUpdated, err := daemon.imageStore.GetLastUpdated(img.ID())
+ lastUpdated, err := daemon.stores[platform].imageStore.GetLastUpdated(img.ID())
if err != nil {
return nil, err
}
diff --git a/daemon/image_tag.go b/daemon/image_tag.go
index 4516c5e..5f28dae 100644
--- a/daemon/image_tag.go
+++ b/daemon/image_tag.go
@@ -32,7 +32,7 @@ func (daemon *Daemon) TagImageWithReference(imageID image.ID, platform string, n
return err
}
- if err := daemon.imageStore.SetLastUpdated(imageID); err != nil {
+ if err := daemon.stores[platform].imageStore.SetLastUpdated(imageID); err != nil {
return err
}
daemon.LogImageEvent(imageID.String(), reference.FamiliarString(newTag), "tag") |
|
ugh; more work to do 😅 |
|
Culprit was due to 6052f2b (#32614). I'll push an update diff --git a/image/store_test.go b/image/store_test.go
index 87101cb..fc6d461 100644
--- a/image/store_test.go
+++ b/image/store_test.go
@@ -154,16 +154,16 @@ func TestGetAndSetLastUpdated(t *testing.T) {
defer cleanup()
id, err := store.Create([]byte(`{"comment": "abc1", "rootfs": {"type": "layers"}}`))
- assert.NilError(t, err)
+ assert.NoError(t, err)
updated, err := store.GetLastUpdated(id)
- assert.NilError(t, err)
+ assert.NoError(t, err)
assert.Equal(t, updated.IsZero(), true)
- assert.NilError(t, store.SetLastUpdated(id))
+ assert.NoError(t, store.SetLastUpdated(id))
updated, err = store.GetLastUpdated(id)
- assert.NilError(t, err)
+ assert.NoError(t, err)
assert.Equal(t, updated.IsZero(), false)
} |
Signed-off-by: Daniel Nephin <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
0496029 to
016eea0
Compare
Includes changes from; - Add a LastTagTime for images (moby/moby#31497) - Fix handling of remote "git@" notation (moby/moby#33696) - Move some `api` package functions away (moby/moby#33798) (related to docker#236) - Set ping version even on error (moby/moby#33827) - Do not add duplicate platform information to service spec (moby/moby#33867) - Refactor MountPoint Setup function in volume.go (moby/moby#33890) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Includes changes from; - Add a LastTagTime for images (moby/moby#31497) - Fix handling of remote "git@" notation (moby/moby#33696) - Move some `api` package functions away (moby/moby#33798) (related to docker#236) - Set ping version even on error (moby/moby#33827) - Do not add duplicate platform information to service spec (moby/moby#33867) - Refactor MountPoint Setup function in volume.go (moby/moby#33890) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Includes changes from; - Add a LastTagTime for images (moby/moby#31497) - Fix handling of remote "git@" notation (moby/moby#33696) - Move some `api` package functions away (moby/moby#33798) (related to docker#236) - Set ping version even on error (moby/moby#33827) - Do not add duplicate platform information to service spec (moby/moby#33867) - Refactor MountPoint Setup function in volume.go (moby/moby#33890) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Includes changes from; - Add a LastTagTime for images (moby/moby#31497) - Fix handling of remote "git@" notation (moby/moby#33696) - Move some `api` package functions away (moby/moby#33798) (related to docker/cli#236) - Set ping version even on error (moby/moby#33827) - Do not add duplicate platform information to service spec (moby/moby#33867) - Refactor MountPoint Setup function in volume.go (moby/moby#33890) Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: 366d3ec971d8007c667e8d7dc8e35a346fb19539 Component: cli
Includes changes from; - Add a LastTagTime for images (moby/moby#31497) - Fix handling of remote "git@" notation (moby/moby#33696) - Move some `api` package functions away (moby/moby#33798) (related to docker#236) - Set ping version even on error (moby/moby#33827) - Do not add duplicate platform information to service spec (moby/moby#33867) - Refactor MountPoint Setup function in volume.go (moby/moby#33890) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Implements proposal #25728