dockerfile: ensure metadata commands have created time#778
dockerfile: ensure metadata commands have created time#778tonistiigi merged 1 commit intomoby:masterfrom
Conversation
| created = h.Created | ||
| if noCreatedTime { | ||
| continue | ||
| } |
There was a problem hiding this comment.
This continue doesn't actually do much -- there is nothing following this in the loop anyway.
Not sure if this loop is trying to find the first or last valid h.Created from history, if you want the first then don't you want an unconditional break here? If the last you don't need anything and in either case noCreatedTime seems redundant in this loop.
There was a problem hiding this comment.
Actually, the loop below looks like a debugged version of this one -- is this just some leftover debug/initial version?
There was a problem hiding this comment.
Its supposed to be break
There was a problem hiding this comment.
Then is noCreatedTime useful in this variant of the loop, isn't an unconditional break fine?
There was a problem hiding this comment.
We want to break after first nil record. Otherwise, the history item for a first metadata command would be the creation time of a base image layer.
There was a problem hiding this comment.
So you are looking for the second layer with a timestamp (because the first is always a base layer)? If so I think it'd be worth expanding the comment.
There was a problem hiding this comment.
First layer with a timestamp after a record without a timestamp. If there is no such then the last layer with timestamp.
There was a problem hiding this comment.
@tonistiigi I think it would be very useful to sum up this conversation in a comment, because I don't think this is obvious at all.
There was a problem hiding this comment.
(probably doesn't need saying, but I agree with @tiborvass ...)
0ba3582 to
3a7a85e
Compare
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3a7a85e to
db3db10
Compare
fixes #776
Fill in the timestamps for metadata commands from the surrounding layers.
Signed-off-by: Tonis Tiigi tonistiigi@gmail.com