Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Show unknown image for workload in list-images
Browse files Browse the repository at this point in the history
Before this change the comparison to list an image as being used by the
workload was purely based upon the tag name. We now also check if the
digest of the image matches the one in our image cache.

In addition, if we are unable to match the image of the workload to a
tag and digest in our image cache, we still list the name of the tag
(as we have no other data available), but with a question mark added
as a prefix ('?->').
  • Loading branch information
hiddeco committed May 8, 2019
1 parent b01a2bf commit db21161
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/fluxctl/list_images_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ func (opts *imageListOpts) RunE(cmd *cobra.Command, args []string) error {
if reg != "" {
reg += "/"
}
if currentTag == "" {
currentTag = "latest"
}
if len(container.Available) == 0 {
availableErr := container.AvailableError
if availableErr == "" {
Expand All @@ -111,9 +114,9 @@ func (opts *imageListOpts) RunE(cmd *cobra.Command, args []string) error {
for _, available := range container.Available {
running := "| "
_, _, tag := available.ID.Components()
if currentTag == tag {
running = "'->"
foundRunning = true
if currentTag == tag && available.Digest == container.Current.Digest {
running = "'->"
foundRunning = true
} else if foundRunning {
running = " "
}
Expand All @@ -122,7 +125,7 @@ func (opts *imageListOpts) RunE(cmd *cobra.Command, args []string) error {
var printEllipsis, printLine bool
if opts.limit <= 0 || lineCount <= opts.limit {
printEllipsis, printLine = false, true
} else if container.Current.ID == available.ID {
} else if currentTag == tag && available.Digest == container.Current.Digest {
printEllipsis, printLine = lineCount > (opts.limit+1), true
}
if printEllipsis {
Expand All @@ -136,6 +139,11 @@ func (opts *imageListOpts) RunE(cmd *cobra.Command, args []string) error {
fmt.Fprintf(out, "\t\t%s %s\t%s\n", running, tag, createdAt)
}
}
if !foundRunning {
running := "?->"
fmt.Fprintf(out, "\t\t%s %s\t\t\n", running, currentTag)

}
workloadName = ""
}
}
Expand Down

0 comments on commit db21161

Please sign in to comment.