container-diff
container-diff copied to clipboard
Don't exit with 0 if images are different
This tool seems to always exit 0 when I run container-diff diff ... on two images that are different. A common convention in diff tools is to exit 0 when there are no differences, 1 when there are differences and 2 when an error occurred.
This would make it simple to use in shell scripts or build pipelines; I don't want to parse the output to discern if there are differences, in fact I probably don't even care about the output at all, I just want to be able to do something like container-diff diff <img1> <img2> || ....
See also the --exit-code option for git diff so having something implied by setting --quiet in #175 could work.
We are working on a common CLI Lib for all our tools and this will be a good feature to add in there.
Any news on this?
Using this tool for what I wanted is a lot harder due to this issue still not being fixed. A good diff-tool allows one to quickly identify if the compared objects are identical, and container-diff makes it a lot more convoluted to evaluate this.
This will provide almost what I want:
[ $(container-diff diff --type file image1 image2 --format='{{if not .Diff.Adds}}0{{else}}1{{end}}{{if not .Diff.Dels}}0{{else}}1{{end}}{{if not .Diff.Mods}}0{{else}}1{{end}}' 2> /dev/null) == "000" ] && echo true
If container-diff exited with 0 when there was no diff and 1 if there was a diff it would be:
container-diff diff --type file image1 image2 && echo true
Why did you close the issue? Is there a solution? If not, can you reopen this issue?
This issue has been open for four years and nothing has apparently changed so I think it's unlikely this will ever be fixed, plus I'm not even using this tool these days.
I'll reopen for the benefit of anyone else.