From: Michael Jeanson Date: Tue, 14 Mar 2017 16:34:06 +0000 (-0400) Subject: jjb: Add coverity to lttng-scope X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7525e08da069498cf67a9c427b751fc172118e6b;p=lttng-ci.git jjb: Add coverity to lttng-scope Signed-off-by: Michael Jeanson --- diff --git a/jobs/lttng-scope.yml b/jobs/lttng-scope.yml index 1584595..d80e9b8 100644 --- a/jobs/lttng-scope.yml +++ b/jobs/lttng-scope.yml @@ -72,6 +72,7 @@ maven-version: "default" goals: "-version" private-repository: true + settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig277b7a2d-b7a6-4ae4-a32d-18c02514e9e4' - maven-target: maven-version: "default" goals: clean install -Dmaven.test.skip=false @@ -184,6 +185,7 @@ maven-version: "default" goals: "-version" private-repository: true + settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig277b7a2d-b7a6-4ae4-a32d-18c02514e9e4' - maven-target: maven-version: "default" goals: clean install -Dmaven.test.skip=false @@ -210,6 +212,51 @@ # channels: # - name: '#lttng' +- job-template: + name: lttng-scope_{version}_coverity + defaults: lttng-scope + node: 'x86-64' + + triggers: + - pollscm: + cron: "@daily" + + wrappers: + - workspace-cleanup + - timestamps + - ansicolor: + colormap: xterm + - credentials-binding: + - username-password-separated: + credential-id: lttng-scope_coverity_token + username: COVERITY_SCAN_PROJECT_NAME + password: COVERITY_SCAN_TOKEN + + scm: + - git: + url: git://github.com/{github_user}/{github_name}.git + browser: githubweb + browser-url: https://github.com/{github_user}/{github_name} + branches: + - origin/{version} + skip-tag: true + basedir: src/lttng-scope + + builders: + - maven-target: + maven-version: "default" + goals: "-version" + private-repository: true + settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig277b7a2d-b7a6-4ae4-a32d-18c02514e9e4' + - shell: + !include-raw-escape: scripts/common/coverity.sh + + publishers: + - workspace-cleanup + - archive: + artifacts: 'analysis-results.tgz,cov-int/**' + allow-empty: false + ## Project - project: @@ -221,10 +268,10 @@ jobs: - 'lttng-scope_{version}_build': arch: !!python/tuple [x86-32, x86-64] - - 'lttng-scope_{version}_winbuild': arch: !!python/tuple [win64] - - 'lttng-scope_{version}_macosxbuild': arch: !!python/tuple [macosx] + - 'lttng-scope_{version}_coverity': + version: master diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index 7b2e946..35352cf 100755 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -66,6 +66,10 @@ lttng-ust) CONF_OPTS="--enable-java-agent-all --enable-python-agent" export CLASSPATH="/usr/share/java/log4j-1.2.jar" ;; +lttng-scope) + CONF_OPTS="" + MVN_BIN="$HOME/tools/hudson.tasks.Maven_MavenInstallation/default/bin/mvn" + ;; *) echo "Generic project, no configure options." CONF_OPTS="" @@ -141,7 +145,7 @@ cd "$SRCDIR" COVERITY_SCAN_VERSION=$(git describe --always | sed 's|-|.|g') -# Prepare build dir +# Prepare build dir for autotools based projects if [ -f "./bootstrap" ]; then ./bootstrap ./configure $CONF_OPTS @@ -149,7 +153,26 @@ fi # Build echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m" -cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" V=1 +case "$COVERITY_SCAN_PROJECT_NAME" in +lttng-scope) + export + cov-configure --java + cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS "$MVN_BIN" \ + -s "$MVN_SETTINGS" \ + -Dmaven.repo.local="$WORKSPACE/.repository" \ + -Dmaven.compiler.fork=true \ + -Dmaven.compiler.forceJavaCompilerUse=true \ + -Dmaven.test.skip=true \ + -DskipTests \ + clean verify + ;; +*) + cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" V=1 + ;; +esac + + + cov-import-scm --dir "$RESULTS_DIR" --scm git --log "$RESULTS_DIR/scm_log.txt" cd "${WORKSPACE}" @@ -172,7 +195,9 @@ response=$(curl \ "$UPLOAD_URL") set -x status_code=$(echo "$response" | sed -n '$p') -if [ "$status_code" != "201" ]; then +if [ "$status_code" == "201" ]; then + echo -e "\033[33;1mCoverity Scan upload successful.\033[0m" +else TEXT=$(echo "$response" | sed '$d') echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m" exit 1