From e8078c7979f2ba5881c26036ff544971cae9f38e Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 2 Sep 2015 17:01:33 -0400 Subject: [PATCH] Add coverity to liburcu --- .gitignore | 2 +- jobs/liburcu.yaml | 43 ++++++++++++++++++++++++++++++++------ scripts/common/coverity.sh | 7 +++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 57d178e..64cf77f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ test/ -.venv/ +.venv*/ etc/jenkins_jobs.ini diff --git a/jobs/liburcu.yaml b/jobs/liburcu.yaml index c08e552..3935532 100644 --- a/jobs/liburcu.yaml +++ b/jobs/liburcu.yaml @@ -36,7 +36,8 @@ wrappers: - workspace-cleanup - timestamps - - ansicolor + - ansicolor: + colormap: xterm scm: - git: @@ -47,7 +48,8 @@ - origin/{version} triggers: - - pollscm: "@hourly" + - pollscm: + cron: "@hourly" properties: - github: @@ -87,7 +89,7 @@ - warnings: console-log-parsers: - 'GNU Make + GNU C Compiler (gcc)' - total-thresholds: + #total-thresholds: #failed: # total-all: 0 # total-high: 0 @@ -102,7 +104,8 @@ defaults: liburcu triggers: - - pollscm: "@daily" + - pollscm: + cron: "@daily" builders: - shell: | @@ -126,7 +129,8 @@ node: 'x86-64' triggers: - - pollscm: "@daily" + - pollscm: + cron: "@daily" builders: - shell: @@ -138,7 +142,32 @@ dir: 'scan-build-archive/' files: 'index.html' -# TODO: liburcu_{version}_coverity +- job-template: + name: liburcu_{version}_coverity + defaults: liburcu + node: 'x86-64' + + triggers: + - pollscm: + cron: "@daily" + + wrappers: + - workspace-cleanup + - timestamps + - ansicolor: + colormap: xterm + - credentials-binding: + - username-password-separated: + credential-id: liburcu_coverity_token + username: COVERITY_SCAN_PROJECT_NAME + password: COVERITY_SCAN_TOKEN + + builders: + - shell: + !include-raw-escape scripts/common/coverity.sh + + publishers: + - workspace-cleanup ## Project @@ -157,4 +186,6 @@ build: !!python/tuple [std] - 'liburcu_{version}_cppcheck' - 'liburcu_{version}_scan-build' + - 'liburcu_{version}_coverity': + version: master diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index 0c7848f..18d4fd5 100644 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -17,6 +17,7 @@ # along with this program. If not, see . # Coverity settings +# The project name and token have to be provided trough env variables #COVERITY_SCAN_PROJECT_NAME="" #COVERITY_SCAN_TOKEN="" COVERITY_SCAN_VERSION=`git describe --always | sed 's|-|.|g'` @@ -62,7 +63,9 @@ fi # Verify upload is permitted +set +x AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted` +set -x if [ "$AUTH_RES" = "Access denied" ]; then echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m" exit 1 @@ -82,7 +85,9 @@ fi if [ ! -d $TOOL_BASE ]; then if [ ! -e $TOOL_ARCHIVE ]; then echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" + set +x wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" + set -x fi # Extract Coverity Scan Analysis Tool @@ -116,6 +121,7 @@ tar czf $RESULTS_ARCHIVE $RESULTS_DIR # Upload results echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m" +set +x response=$(curl \ --silent --write-out "\n%{http_code}\n" \ --form project=$COVERITY_SCAN_PROJECT_NAME \ @@ -125,6 +131,7 @@ response=$(curl \ --form version=$COVERITY_SCAN_VERSION \ --form description=$COVERITY_SCAN_DESCRIPTION \ $UPLOAD_URL) +set -x status_code=$(echo "$response" | sed -n '$p') if [ "$status_code" != "201" ]; then TEXT=$(echo "$response" | sed '$d') -- 2.34.1