-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Resolve no clean images detected issue; Remove extra blank image name #1055
Conversation
Thanks for making a pull request! 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use json as the format? https://stackoverflow.com/questions/50285252/docker-images-output-as-json-using-format
It outputs in JSONL format
$ docker images --format '{{json .}}'
{"Containers":"N/A","CreatedAt":"2021-12-01 19:05:10 +0530 IST","CreatedSince":"19 months ago","Digest":"\u003cnone\u003e","ID":"cc3b650a3f92","Repository":"registry.access.redhat.com/ubi8/go-toolset","SharedSize":"N/A","Size":"1.09GB","Tag":"1.16.7","UniqueSize":"N/A","VirtualSize":"1.086GB"}
{"Containers":"N/A","CreatedAt":"2021-11-16 17:33:48 +0530 IST","CreatedSince":"19 months ago","Digest":"\u003cnone\u003e","ID":"c04867c5b867","Repository":"quay.io/keycloak/keycloak","SharedSize":"N/A","Size":"717MB","Tag":"15.0.2","UniqueSize":"N/A","VirtualSize":"716.6MB"}
{"Containers":"N/A","CreatedAt":"2021-09-24 04:09:54 +0530 IST","CreatedSince":"21 months ago","Digest":"\u003cnone\u003e","ID":"df5477cea558","Repository":"hello-world","SharedSize":"N/A","Size":"9.06kB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"9.056kB"}
{"Containers":"N/A","CreatedAt":"2021-01-25 22:46:49 +0530 IST","CreatedSince":"2 years ago","Digest":"\u003cnone\u003e","ID":"dd91347f1318","Repository":"gcr.io/cassandra-operator/cassandra-operator","SharedSize":"N/A","Size":"41.9MB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"41.9MB"}
{"Containers":"N/A","CreatedAt":"2016-10-22 02:11:46 +0530 IST","CreatedSince":"6 years ago","Digest":"\u003cnone\u003e","ID":"1999482cb0a5","Repository":"mongo","SharedSize":"N/A","Size":"391MB","Tag":"2.6","UniqueSize":"N/A","VirtualSize":"391MB"}
{"Containers":"N/A","CreatedAt":"1980-01-01 05:30:01 +0530 IST","CreatedSince":"43 years ago","Digest":"\u003cnone\u003e","ID":"98ac5ea57540","Repository":"paketobuildpacks/builder","SharedSize":"N/A","Size":"1.97GB","Tag":"full","UniqueSize":"N/A","VirtualSize":"1.966GB"}
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #1055 +/- ##
=======================================
Coverage 14.43% 14.43%
=======================================
Files 86 86
Lines 8176 8175 -1
=======================================
Hits 1180 1180
+ Misses 6690 6689 -1
Partials 306 306
☔ View full report in Codecov by Sentry. |
Using the $ docker images --format '{{.Repository}}:{{.Tag}}'
quay.io/konveyor/move2kube-ui:latest
nginx:stable-alpine $ docker images --format '{{json .}}'
{"Containers":"N/A","CreatedAt":"2023-06-22 14:13:14 +0530 IST","CreatedSince":"6 days ago","Digest":"\u003cnone\u003e","ID":"a192738e1b92","Repository":"quay.io/konveyor/move2kube-ui","SharedSize":"N/A","Size":"212MB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"212.1MB"}
{"Containers":"N/A","CreatedAt":"2023-06-15 08:29:26 +0530 IST","CreatedSince":"13 days ago","Digest":"\u003cnone\u003e","ID":"ba1fca8fb480","Repository":"nginx","SharedSize":"N/A","Size":"40.7MB","Tag":"stable-alpine","UniqueSize":"N/A","VirtualSize":"40.7MB"} |
@@ -143,14 +143,17 @@ func getAllImageNames() ([]string, error) { | |||
logrus.Warnf("Error while running docker image list : %s", err) | |||
return nil, err | |||
} | |||
images := strings.Split(string(outputStr), "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no empty string check for outputStr
. Do you want to add a check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
… name Signed-off-by: Akash Nayak <akash19nayak@gmail.com>
…k image name Signed-off-by: Akash Nayak <akash19nayak@gmail.com>
Head branch was pushed to by a user without write access
ca61731
to
8ac5b4f
Compare
Fixes- #1054
There was a image with blank name getting appended to the images list because of
\n
character at the end ofoutputStr
- [quay.io/konveyor/move2kube-ui:latest nginx:stable-alpine ].Signed-off-by: Akash Nayak akash19nayak@gmail.com