FairwindsOps/pluto

Exit codes not working since 5.12

tmsdce opened this issue ยท 3 comments

tmsdce commented

What happened?

Starting with version 5.12, exit codes don't behave as they used to. Detection still works but exit code seems to be always 0 which is problematic especially in CI context.

What did you expect to happen?

Exit codes should work as before as stated in the documentation here

How can we reproduce this?

  • Create a simple test.yaml file with the following content
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: test
  namespace: test
spec:
  minAvailable: 1
  selector:
    matchLabels:
      app: test
  • Use pluto 5.12 or higher (5.18 is also affected) to check for APIs deprecation/removal
$ pluto detect test.yaml --target-versions k8s=v1.26.0

NAME   KIND                  VERSION          REPLACEMENT   REMOVED   DEPRECATED  
test   PodDisruptionBudget   policy/v1beta1   policy/v1     true      true        



Want more? Automate Pluto for free with Fairwinds Insights!
 ๐Ÿš€ https://fairwinds.com/insights-signup/pluto ๐Ÿš€ 

$ echo $?
0
  • If you use pluto 5.11.2 or less, everything works fine
$ pluto detect test.yaml --target-versions k8s=v1.26.0

NAME   KIND                  VERSION          REPLACEMENT   REMOVED   DEPRECATED  
test   PodDisruptionBudget   policy/v1beta1   policy/v1     true      true

$ echo $?
3

I also tried to disable the footer with --no-footer with no success. I believe that this behavior comes from 04a8af3 if I compare commits between 5.11.2 and 5.12

Version

5.12

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

Yikes, great catch. Looks like this PR (https://github.com/FairwindsOps/pluto/pull/427/files) is the likely culprit, having touched the exit code logic. I think we're still calculating it, just not actually exiting.

Also, the e2e tests should have caught this.... ๐Ÿค”

Looking closer, it may only be the raw detect command that is doing this, not the others, which may explain the tests not catching it. I'll look at adding additional tests too

tmsdce commented

Thanks for your prompt reply @sudermanjr ๐Ÿ‘