|
4 | 4 | "encoding/json" |
5 | 5 | "errors" |
6 | 6 | "io" |
7 | | - "reflect" |
8 | 7 | "runtime" |
9 | 8 | "strings" |
10 | 9 | "time" |
@@ -53,7 +52,7 @@ type V1Image struct { |
53 | 52 | Comment string `json:"comment,omitempty"` |
54 | 53 |
|
55 | 54 | // Created is the timestamp at which the image was created |
56 | | - Created time.Time `json:"created"` |
| 55 | + Created *time.Time `json:"created"` |
57 | 56 |
|
58 | 57 | // Container is the ID of the container that was used to create the image. |
59 | 58 | // |
@@ -261,44 +260,21 @@ func NewChildImage(img *Image, child ChildConfig, os string) *Image { |
261 | 260 | } |
262 | 261 |
|
263 | 262 | // History stores build commands that were used to create an image |
264 | | -type History struct { |
265 | | - // Created is the timestamp at which the image was created |
266 | | - Created time.Time `json:"created"` |
267 | | - // Author is the name of the author that was specified when committing the |
268 | | - // image, or as specified through MAINTAINER (deprecated) in the Dockerfile. |
269 | | - Author string `json:"author,omitempty"` |
270 | | - // CreatedBy keeps the Dockerfile command used while building the image |
271 | | - CreatedBy string `json:"created_by,omitempty"` |
272 | | - // Comment is the commit message that was set when committing the image |
273 | | - Comment string `json:"comment,omitempty"` |
274 | | - // EmptyLayer is set to true if this history item did not generate a |
275 | | - // layer. Otherwise, the history item is associated with the next |
276 | | - // layer in the RootFS section. |
277 | | - EmptyLayer bool `json:"empty_layer,omitempty"` |
278 | | -} |
| 263 | +type History = ocispec.History |
279 | 264 |
|
280 | 265 | // NewHistory creates a new history struct from arguments, and sets the created |
281 | 266 | // time to the current time in UTC |
282 | 267 | func NewHistory(author, comment, createdBy string, isEmptyLayer bool) History { |
| 268 | + now := time.Now().UTC() |
283 | 269 | return History{ |
284 | 270 | Author: author, |
285 | | - Created: time.Now().UTC(), |
| 271 | + Created: &now, |
286 | 272 | CreatedBy: createdBy, |
287 | 273 | Comment: comment, |
288 | 274 | EmptyLayer: isEmptyLayer, |
289 | 275 | } |
290 | 276 | } |
291 | 277 |
|
292 | | -// Equal compares two history structs for equality |
293 | | -func (h History) Equal(i History) bool { |
294 | | - if !h.Created.Equal(i.Created) { |
295 | | - return false |
296 | | - } |
297 | | - i.Created = h.Created |
298 | | - |
299 | | - return reflect.DeepEqual(h, i) |
300 | | -} |
301 | | - |
302 | 278 | // Exporter provides interface for loading and saving images |
303 | 279 | type Exporter interface { |
304 | 280 | Load(io.ReadCloser, io.Writer, bool) error |
|
0 commit comments