Skip to content

Commit

Permalink
fix: adding condition check failing part for post cmd (#119)
Browse files Browse the repository at this point in the history
* fix: adding condition check failing part

* fix: add another condition to handle empty number of failing

* refactor: remove unused qoutes

---------

Co-authored-by: Muhammad Luthfi Fahlevi <muhammad.fahlevi@gojek.com>
  • Loading branch information
luthfifahlevi and Muhammad Luthfi Fahlevi authored Oct 18, 2024
1 parent 87e4af7 commit 6361b97
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions stable/meteor/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ spec:
- /bin/sh
- -c
- |
meteor run /opt/recipes;
{{- if .Values.postCmd.enabled }}
OUTPUT=$(meteor run /opt/recipes;)
METEOR_EXIT_CODE=$?
if [ $METEOR_EXIT_CODE -eq 0 ]; then
{{- if .Values.postCmd.enabled }}
NUM_FAILING=$(echo $OUTPUT | grep -o '^[0-9]* failing' | awk '{print $1}')
# if the output does not contains number of failing, then it is failed
if [ -z $NUM_FAILING ]; then
NUM_FAILING=-1
fi
# run post cmd only if exit code is success and no any failing occurred in meteor job
if [ $METEOR_EXIT_CODE -eq 0 ] && [ $NUM_FAILING -eq 0 ]; then
{{- .Values.postCmd.cmd | nindent 18 }}
fi
{{- end }}
Expand Down

0 comments on commit 6361b97

Please sign in to comment.