Skip to content

Commit

Permalink
Add CreatedSince & CreatedAt format fields to podman image history
Browse files Browse the repository at this point in the history
Fixes: containers#14012

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Apr 27, 2022
1 parent e4be261 commit 519d0af
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/podman/images/history.go
Expand Up @@ -168,3 +168,11 @@ func (h historyReporter) ID() string {
}
return h.ImageHistoryLayer.ID
}

func (h historyReporter) CreatedAt() string {
return h.ImageHistoryLayer.Created.UTC().String()
}

func (h historyReporter) CreatedSince() string {
return h.Created()
}
15 changes: 15 additions & 0 deletions test/system/010-images.bats
Expand Up @@ -312,4 +312,19 @@ Deleted: $pauseID"
is "$output" ""
}

@test "podman image history" {
run_podman image list --format '{{.CreatedSince}}' $IMAGE
imageSince="$output"
run_podman image list --format '{{.CreatedAt}}' $IMAGE
run cut -f1 -d'.' <<< "$output"
imageAt="$output"
run_podman image history $IMAGE
run_podman image history --format '{{.CreatedSince}}' $IMAGE
is "${lines[0]}" "$imageSince" "History image list should match .CreatedSince"
run_podman image history --format '{{.CreatedAt}}' $IMAGE
line="$lines[0]"
run cut -f1 -d'.' <<< "$line"
assert "${output}" == "$imageAt" "History image list should match .CreatedAt"
}

# vim: filetype=sh

0 comments on commit 519d0af

Please sign in to comment.