Skip to content

Commit

Permalink
Hide CI passed logs for yaml files checking
Browse files Browse the repository at this point in the history
  • Loading branch information
rfan1 committed Feb 15, 2023
1 parent 869a288 commit 024e776
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,7 @@ test_pod_whitespace_rule:

.PHONY: test-yaml-valid
test-yaml-valid:
$(eval YAMLS=$(shell sh -c "git ls-files schedule/ test_data/ | grep '\\.ya\?ml$$'"))
if test -n "$(YAMLS)"; then \
export PERL5LIB=${PERL5LIB_} ; echo "$(YAMLS)" | xargs tools/test_yaml_valid ;\
else \
echo "No yamls modified.";\
fi
if test -n "$(YAMLS)"; then \
which yamllint >/dev/null 2>&1 || echo "Command 'yamllint' not found, can not execute YAML syntax checks";\
echo "$(YAMLS)" | xargs yamllint -c .yamllint;\
fi
tools/check_yaml

.PHONY: test-modules-in-yaml-schedule
test-modules-in-yaml-schedule:
Expand Down
14 changes: 14 additions & 0 deletions tools/check_yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -e

success=1
YAMLS=$(git ls-files schedule/ test_data/ | grep '.ya\?ml$' | xargs echo)

if test -n "$YAMLS"; then
export PERL5LIB=${PERL5LIB_} ; echo "$YAMLS" | xargs tools/test_yaml_valid | grep -Ev "has valid yaml syntax|has valid schema";
which yamllint >/dev/null 2>&1 || (echo "Command 'yamllint' not found, can not execute YAML syntax checks" && exit 1) || success=0;
echo "$YAMLS" | xargs yamllint -c .yamllint || exit 1 || success=0;
else
echo "No yamls modified.";
fi
[ $success = 1 ] && echo "check_yaml SUCCESS" && exit 0
exit 1

0 comments on commit 024e776

Please sign in to comment.