mirror of https://github.com/containers/podman.git
Add CreatedSince & CreatedAt format fields to podman image history
Fixes: https://github.com/containers/podman/issues/14012 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
e4be261755
commit
22b421dd7e
|
@ -168,3 +168,11 @@ func (h historyReporter) ID() string {
|
||||||
}
|
}
|
||||||
return h.ImageHistoryLayer.ID
|
return h.ImageHistoryLayer.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h historyReporter) CreatedAt() string {
|
||||||
|
return time.Unix(h.ImageHistoryLayer.Created.Unix(), 0).UTC().String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h historyReporter) CreatedSince() string {
|
||||||
|
return h.Created()
|
||||||
|
}
|
||||||
|
|
|
@ -23,10 +23,11 @@ Valid placeholders for the Go template are listed below:
|
||||||
| --------------- | ----------------------------------------------------------------------------- |
|
| --------------- | ----------------------------------------------------------------------------- |
|
||||||
| .ID | Image ID |
|
| .ID | Image ID |
|
||||||
| .Created | if --human, time elapsed since creation, otherwise time stamp of creation |
|
| .Created | if --human, time elapsed since creation, otherwise time stamp of creation |
|
||||||
| .CreatedBy | Command used to create the layer |
|
| .CreatedAt | Time when the image layer was created |
|
||||||
| .Size | Size of layer on disk |
|
| .CreatedBy | Command used to create the layer |
|
||||||
| .Comment | Comment for the layer |
|
| .CreatedSince | Elapsed time since the image layer was created |
|
||||||
|
| .Size | Size of layer on disk |
|
||||||
|
| .Comment | Comment for the layer |
|
||||||
## OPTIONS
|
## OPTIONS
|
||||||
|
|
||||||
Print the numeric IDs only (default *false*).
|
Print the numeric IDs only (default *false*).
|
||||||
|
|
|
@ -55,4 +55,17 @@ size | -\\\?[0-9]\\\+
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman image history Created" {
|
||||||
|
# Values from image LIST
|
||||||
|
run_podman image list --format '{{.CreatedSince}}--{{.CreatedAt}}' $IMAGE
|
||||||
|
from_imagelist="$output"
|
||||||
|
assert "$from_imagelist" =~ "^[0-9].* ago--[0-9]+-[0-9]+-[0-9]+ [0-9:]+ " \
|
||||||
|
"CreatedSince and CreatedAt look reasonable"
|
||||||
|
|
||||||
|
# Values from image HISTORY
|
||||||
|
run_podman image history --format '{{.CreatedSince}}--{{.CreatedAt}}' $IMAGE
|
||||||
|
assert "${lines[0]}" == "$from_imagelist" \
|
||||||
|
"CreatedSince and CreatedAt from image history should == image list"
|
||||||
|
}
|
||||||
|
|
||||||
# vim: filetype=sh
|
# vim: filetype=sh
|
||||||
|
|
Loading…
Reference in New Issue