summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-11-27 15:31:22 +0100
committerGitHub <noreply@github.com>2019-11-27 15:31:22 +0100
commit2178875fa7975f00a4da15fef9809cd3fb74feba (patch)
tree10f039a78dec47c3b809c7a964b61fd6ee95af46 /cmd/podman
parent27a09f8fab740749964d28b5ead1a43c6d77a7c8 (diff)
parent63e46cc85cb0a9523e9c48db7a88039e0baeac29 (diff)
downloadpodman-2178875fa7975f00a4da15fef9809cd3fb74feba.tar.gz
podman-2178875fa7975f00a4da15fef9809cd3fb74feba.tar.bz2
podman-2178875fa7975f00a4da15fef9809cd3fb74feba.zip
Merge pull request #4568 from openSUSE/history
Add support for image name history
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cliconfig/config.go1
-rw-r--r--cmd/podman/images.go10
-rw-r--r--cmd/podman/varlink/io.podman.varlink3
3 files changed, 13 insertions, 1 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 27d94f769..a34afa827 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -64,6 +64,7 @@ type ImagesValues struct {
NoTrunc bool
Quiet bool
Sort string
+ History bool
}
type EventValues struct {
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index 7d498517c..6b16272f4 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -32,6 +32,7 @@ type imagesTemplateParams struct {
CreatedTime time.Time
Size string
ReadOnly bool
+ History string
}
type imagesJSONParams struct {
@@ -42,6 +43,7 @@ type imagesJSONParams struct {
Created time.Time `json:"created"`
Size *uint64 `json:"size"`
ReadOnly bool `json:"readonly"`
+ History []string `json:"history"`
}
type imagesOptions struct {
@@ -53,6 +55,7 @@ type imagesOptions struct {
outputformat string
sort string
all bool
+ history bool
}
// Type declaration and functions for sorting the images output
@@ -124,6 +127,7 @@ func imagesInit(command *cliconfig.ImagesValues) {
flags.BoolVar(&command.NoTrunc, "no-trunc", false, "Do not truncate output")
flags.BoolVarP(&command.Quiet, "quiet", "q", false, "Display only image IDs")
flags.StringVar(&command.Sort, "sort", "created", "Sort by created, id, repository, size, or tag")
+ flags.BoolVarP(&command.History, "history", "", false, "Display the image name history")
}
@@ -171,6 +175,7 @@ func imagesCmd(c *cliconfig.ImagesValues) error {
format: c.Format,
sort: c.Sort,
all: c.All,
+ history: c.History,
}
opts.outputformat = opts.setOutputFormat()
@@ -214,6 +219,9 @@ func (i imagesOptions) setOutputFormat() string {
format += "{{.Digest}}\t"
}
format += "{{.ID}}\t{{.Created}}\t{{.Size}}\t"
+ if i.history {
+ format += "{{if .History}}{{.History}}{{else}}<none>{{end}}\t"
+ }
return format
}
@@ -306,6 +314,7 @@ func getImagesTemplateOutput(ctx context.Context, images []*adapter.ContainerIma
Created: units.HumanDuration(time.Since(createdTime)) + " ago",
Size: sizeStr,
ReadOnly: img.IsReadOnly(),
+ History: strings.Join(img.NamesHistory(), ", "),
}
imagesOutput = append(imagesOutput, params)
if opts.quiet { // Show only one image ID when quiet
@@ -336,6 +345,7 @@ func getImagesJSONOutput(ctx context.Context, images []*adapter.ContainerImage)
Created: img.Created(),
Size: size,
ReadOnly: img.IsReadOnly(),
+ History: img.NamesHistory(),
}
imagesOutput = append(imagesOutput, params)
}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 4f810dd53..e76b9627e 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -70,7 +70,8 @@ type Image (
labels: [string]string,
isParent: bool,
topLayer: string,
- readOnly: bool
+ readOnly: bool,
+ history: []string
)
# ImageHistory describes the returned structure from ImageHistory.