lilydjwg/nvchecker

Fail on cmd fail

aminvakil opened this issue · 6 comments

If a cmd fails and return code is non-zero it's expected for nvchecker to fail as well.
I've faced this here:
https://github.com/aminvakil/nvchecker/runs/4842721891?check_suite_focus=true

grafana_dashboard_1860: command exited with error cmd=curl -s https://api.github.com/repos/rfrail3/grafana-dashboards/commits?path=prometheus/node-exporter-full.json&page=1&per_page=1 | jq -r '.[0].commit.committer.date' error='/bin/sh: line 1: jq: command not found' returncode=127

Maybe it does not check for errors after piping though.

Do you mean that you want to get a non-zero exit code when there is any error from any entry? I can add a cmdline flag if you want this behavior. It's not possible to signal which error occurs with the exit code though.

The current design is that, you filter error messages from the json log output and process them.

Do you mean that you want to get a non-zero exit code when there is any error from any entry? I can add a cmdline flag if you want this behavior. It's not possible to signal which error occurs with the exit code though.

What do you think yourself about this? Do you expect an error when something goes wrong (and it returns non-zero code) in cmd section? I think it should fail from my POV. But if you think there are situations which failing is fine, this can be a flag.

The current design is that, you filter error messages from the json log output and process them.

I think any non-zero return code is an error and there is no need to filter the output to see what has happened, if the result has changed nvchecker will notice already.

Do you expect an error when something goes wrong (and it returns non-zero code) in cmd section?

No. There are a lot of entries to check, and it's expected that some of them fail for one reason or another (e.g. network issues, upstream downtime). A non-zero status code says little about what goes wrong.

I think any non-zero return code is an error and there is no need to filter the output to see what has happened.

Well, you can raise the log level to see only warnings and errors.

No. There are a lot of entries to check, and it's expected that some of them fail for one reason or another (e.g. network issues, upstream downtime). A non-zero status code says little about what goes wrong.

What about something like any_error_fatal = true to make nvchecker fail in case there was any failure in that section?
Can this be added so that it can be configured per software?

I can add an option to indicate errors with exit code, but it wouldn't be fatal -- there is no reason to give up other entries if one entry fails.

I'll try to come up with a patch tomorrow if it's okey for you.

I can add an option to indicate errors with exit code, but it wouldn't be fatal -- there is no reason to give up other entries if one entry fails.

I meant exactly the same thing, fatal for the entry that error has happened, feel free to change its name to whatever you see fit.

I'll try to come up with a patch tomorrow if it's okey for you.

Come up with a patch next year if you want :) I have not employed you, thanks for your time!