-
Notifications
You must be signed in to change notification settings - Fork 242
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
Return non-zero exit status on no valid objects #209
Return non-zero exit status on no valid objects #209
Conversation
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.
Thanks for the PR!
pkg/command/lint/command.go
Outdated
fmt.Fprintln(os.Stderr, "Warning: no valid objects found.") | ||
return nil |
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.
This breaks backward compatibility, and is more in line with how I'd expect a linter to work -- just emit a warning if there are no valid objects, but don't fail altogether. I would be open to adding a flag, though, that controls this, so that it someone passes it in (say, "--fail-if-no-objects-found"), then we return an error. What do you think?
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.
I clearly missed that one, will try to make a flag, thanks for the review!
@viswajithiii I've added the I've run the new e2e tests locally by KUBE_LINTER_BIN=~/workspace/kube-linter/bin/darwin/kube-linter go test e2etests/sanity_test.go ..and they passed. We use the |
Instead of printing the warning and return 0 exit status return Error and exit with 1 Reasoning: our kube-linter pipelines where silently failing for a while without any notice because of 0 exit status See k8gb-io/k8gb#615 (comment) Signed-off-by: Yury Tsarev <[email protected]>
Signed-off-by: Jirka Kremser <[email protected]>
Signed-off-by: Jirka Kremser <[email protected]>
rebased on |
@viswajithiii hey, how does it look to you now? I think @jkremser addressed the issue the best possible way |
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.
Thank you! Sorry for the late review, I missed the previous notification.
@viswajithiii thanks for merging 👍 may I ask if there will be a release with the change? Or if there is a way to specify the version of the |
Sure I can handle this after the weekend |
Instead of printing the warning and return 0 exit status
return Error and exit with 1
Reasoning: our kube-linter pipelines where silently failing
for a while without any notice because of 0 exit status
See k8gb-io/k8gb#615 (comment)
Signed-off-by: Yury Tsarev [email protected]