From b0c86796953645d6f1c5192f96aec95a31738e72 Mon Sep 17 00:00:00 2001 From: Ed Kern Date: Wed, 25 Sep 2019 10:09:41 -0600 Subject: [PATCH] vpp: add daily static analysis report job This adds a new job that runs daily that scrapes and reports to vpp-dev list on outstanding static analysis bugs. Change-Id: Iceb2a272db157f6d47aca826ddcc498c9f6cffec Signed-off-by: Ed Kern --- jjb/vpp/include-raw-vpp-coverity.sh | 32 ++++++++++++ jjb/vpp/vpp.yaml | 101 ++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 jjb/vpp/include-raw-vpp-coverity.sh diff --git a/jjb/vpp/include-raw-vpp-coverity.sh b/jjb/vpp/include-raw-vpp-coverity.sh new file mode 100644 index 000000000..47a316a89 --- /dev/null +++ b/jjb/vpp/include-raw-vpp-coverity.sh @@ -0,0 +1,32 @@ +#!/bin/bash +FILE="scan.txt" +OUTPUT="output.txt" + +wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +dpkg -i google-chrome-stable_current_amd64.deb || true +apt-get install -f -y + +google-chrome --headless --disable-gpu -dump-dom --no-sandbox https://scan.coverity.com/projects/fd-io-vpp > $FILE + +grep -i '
Newly detected
' $FILE || exit 42 + +NEW=$(grep -i -B 1 '
Newly detected
' $FILE | grep -Eo '[0-9]{1,4}') +ELIM=$(grep -i -B 1 '
Eliminated
' $FILE | grep -Eo '[0-9]{1,4}') +OUT=$(grep -i -B 1 '
Outstanding
' $FILE | grep -Eo '[0-9]{1,4}') + +#ls -lg $FILE +#cat $FILE + +if [ "${OUT}" == "0" ]; then + echo 'Current outstanding issues are zero' > $OUTPUT + echo "Newly detected: $NEW" >> $OUTPUT + echo "Eliminated: $ELIM" >> $OUTPUT + echo "More details can be found at https://scan.coverity.com/projects/fd-io-vpp/view_defects" >> $OUTPUT +else + echo "Current number of outstanding issues are $OUT Failing job" + echo "Current number of outstanding issues are $OUT" > $OUTPUT + echo "Newly detected: $NEW" >> $OUTPUT + echo "Eliminated: $ELIM" >> $OUTPUT + echo "More details can be found at https://scan.coverity.com/projects/fd-io-vpp/view_defects" >> $OUTPUT + exit 1 +fi diff --git a/jjb/vpp/vpp.yaml b/jjb/vpp/vpp.yaml index dbd3dd79a..5d294e850 100644 --- a/jjb/vpp/vpp.yaml +++ b/jjb/vpp/vpp.yaml @@ -30,6 +30,7 @@ name: vpp-clang jobs: - 'vpp-verify-{stream}-clang' + - 'vpp-coverity-{stream}' project: 'vpp' os: @@ -710,6 +711,106 @@ max-failed-builds: 1 fixed-delay: 90 +- job-template: + name: 'vpp-coverity-{stream}' + + project-type: freestyle + node: 'ubuntu1804-us' + concurrent: true + + build-discarder: + daysToKeep: '{build-days-to-keep}' + numToKeep: '{build-num-to-keep}' + artifactDaysToKeep: '{build-artifact-days-to-keep}' + artifactNumToKeep: '{build-artifact-num-to-keep}' + + parameters: + - project-parameter: + project: '{project}' + - gerrit-parameter: + branch: '{branch}' + - os-parameter: + os: 'ubuntu1804' + - repo-name-parameter: + repo-name: '{repo-stream-part}.ubuntu.bionic.main' + - stream-parameter: + stream: '{stream}' + + scm: + - gerrit-trigger-scm: + credentials-id: 'jenkins-gerrit-credentials' + refspec: '' + choosing-strategy: 'gerrit' + + wrappers: + - fdio-infra-wrappers: + build-timeout: '{build-timeout}' + + triggers: + - timed: '0 14 * * *' + + builders: + - shell: + !include-raw-escape: include-raw-vpp-coverity.sh +# TODO: make unstable return actually work with include-raw-escape +# unstable-return: 42 + + publishers: + - email-ext: + # yamllint disable-line rule:line-length + recipients: 'ejk@cisco.com' + reply-to: '' + content-type: 'text' + subject: 'Coverity run passing as of $BUILD_TIMESTAMP' + # yamllint disable-line rule:line-length + body: | + Coverity run passing. + + ${{FILE,path="output.txt"}} + failure: false + success: true + - email-ext: + # yamllint disable-line rule:line-length + recipients: 'ejk@cisco.com' + reply-to: '' + content-type: 'text' + subject: 'Coverity run UNSTABLE as of $BUILD_TIMESTAMP' + # yamllint disable-line rule:line-length + body: | + Coverity run UNSTABLE. + + Something went wrong with daily scan. + failure: false + unstable: true + - email-ext: + # yamllint disable-line rule:line-length + recipients: 'vpp-dev@lists.fd.io, ejk@cisco.com' + reply-to: '' + content-type: 'text' + subject: 'Coverity run FAILED as of $BUILD_TIMESTAMP' + # yamllint disable-line rule:line-length + body: | + Coverity run failed today. + + ${{FILE,path="output.txt"}} + failure: true + - email-ext: + # yamllint disable-line rule:line-length + recipients: 'vpp-dev@lists.fd.io, ejk@cisco.com' + reply-to: '' + content-type: 'text' + subject: 'Coverity run as of $BUILD_TIMESTAMP' + # yamllint disable-line rule:line-length + body: | + Coverity run fixed today. + + ${{FILE,path="output.txt"}} + failure: false + fixed: true + - fdio-infra-shiplogs: + maven-version: 'mvn36' + archive-artifacts: '/tmp/vpp-failed-unittests/*/* **/core' + - job-template: name: 'vpp-merge-{stream}-{os}' -- 2.16.6