From 840eb0be4ee45388327045b7949fed507974bdfd Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 16 Mar 2017 10:38:45 -0400 Subject: [PATCH] Capture paver quality logs into the artifacts directory Capture paver quality build stdout and stderr into separate log files Send pylint results directly to a report file, so that we don't overwhelm jenkins --- pavelib/quality.py | 6 +++--- scripts/generic-ci-tests.sh | 36 ++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pavelib/quality.py b/pavelib/quality.py index 4e534d7e81..77dcca9b34 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -66,7 +66,7 @@ def find_fixme(options): sh( "{pythonpath_prefix} pylint --disable all --enable=fixme " "--output-format=parseable {apps} " - "| tee {report_dir}/pylint_fixme.report".format( + "> {report_dir}/pylint_fixme.report".format( pythonpath_prefix=pythonpath_prefix, apps=apps_list, report_dir=report_dir @@ -116,8 +116,8 @@ def run_pylint(options): ) sh( - "{pythonpath_prefix} pylint {flags} --output-format=parseable {apps} | " - "tee {report_dir}/pylint.report".format( + "{pythonpath_prefix} pylint {flags} --output-format=parseable {apps} " + "> {report_dir}/pylint.report".format( pythonpath_prefix=pythonpath_prefix, flags=" ".join(flags), apps=apps_list, diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index d835b0344f..e0b6111702 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -76,31 +76,47 @@ else fi PARALLEL="--processes=-1" export SUBSET_JOB=$JOB_NAME + +function run_paver_quality { + QUALITY_TASK=$1 + shift + mkdir -p test_root/log/ + LOG_PREFIX=test_root/log/$QUALITY_TASK + paver $QUALITY_TASK $* 2> $LOG_PREFIX.err.log > $LOG_PREFIX.out.log || { + echo "STDOUT:"; + cat $LOG_PREFIX.out.log; + echo "STDERR:"; + cat $LOG_PREFIX.err.log; + return 1; + } + return 0; +} + case "$TEST_SUITE" in "quality") echo "Finding fixme's and storing report..." - paver find_fixme > fixme.log || { cat fixme.log; EXIT=1; } + run_paver_quality find_fixme || EXIT=1 echo "Finding pep8 violations and storing report..." - paver run_pep8 > pep8.log || { cat pep8.log; EXIT=1; } + run_paver_quality run_pep8 || EXIT=1 echo "Finding pylint violations and storing in report..." - paver run_pylint -l $LOWER_PYLINT_THRESHOLD:$UPPER_PYLINT_THRESHOLD > pylint.log || { echo 'Too many pylint violations. You can view them in pylint.log'; EXIT=1; } + run_paver_quality run_pylint -l $LOWER_PYLINT_THRESHOLD:$UPPER_PYLINT_THRESHOLD || EXIT=1 mkdir -p reports echo "Finding ESLint violations and storing report..." - paver run_eslint -l $ESLINT_THRESHOLD > eslint.log || { echo 'Too many eslint violations. You can view them in eslint.log'; EXIT=1; } + run_paver_quality run_eslint -l $ESLINT_THRESHOLD || EXIT=1 echo "Finding Stylelint violations and storing report..." - paver run_stylelint -l $STYLELINT_THRESHOLD > stylelint.log || { echo 'Too many stylelint violations. You can view them in stylelint.log'; EXIT=1; } + run_paver_quality run_stylelint -l $STYLELINT_THRESHOLD || EXIT=1 echo "Running code complexity report (python)." - paver run_complexity || echo "Unable to calculate code complexity. Ignoring error." + run_paver_quality run_complexity || echo "Unable to calculate code complexity. Ignoring error." echo "Running xss linter report." - paver run_xsslint -t $XSSLINT_THRESHOLDS > xsslint.log || { echo 'Too many xsslint violations. You can view them in xsslint.log'; EXIT=1; } - echo "Running xss commit linter report." - paver run_xsscommitlint > xsscommitlint.log || { cat xsscommitlint.log; EXIT=1; } + run_paver_quality run_xsslint -t $XSSLINT_THRESHOLDS || EXIT=1 + echo "Running safe commit linter report." + run_paver_quality run_xsscommitlint || EXIT=1 # Run quality task. Pass in the 'fail-under' percentage to diff-quality echo "Running diff quality." - paver run_quality -p 100 || EXIT=1 + run_paver_quality run_quality -p 100 || EXIT=1 # Need to create an empty test result so the post-build # action doesn't fail the build.