reanahub / reana-client

REANA command-line client
http://reana-client.readthedocs.io/
MIT License
10 stars 45 forks source link

validate: use proper exit codes for failures #561

Closed tiborsimko closed 2 years ago

tiborsimko commented 2 years ago

Current behaviour

When a reana.yaml has failures, the validate properly reports about them, but the exit code is 0. Example:

$ cd reana-demo-helloworld
$ sed -i 's,workflow:,workflowx::,g' reana.yaml
$ $ git diff
diff --git a/reana.yaml b/reana.yaml
index 50d1bd8..022a114 100644
--- a/reana.yaml
+++ b/reana.yaml
@@ -8,7 +8,7 @@ inputs:
     inputfile: data/names.txt
     outputfile: results/greetings.txt
     sleeptime: 0
-workflow:
+workflowx::
   type: serial
   specification:
     steps:
$ reana-client validate
==> ERROR: Something went wrong when trying to validate reana-demo-helloworld/reana.yaml
$ echo $?
0

Expected behaviour

$ echo $?
1

IOW, all findings of validate that result in "ERROR" should exit with some non-zero status code, such as 1.