summaryrefslogtreecommitdiffstats
path: root/coverity-scan.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:47 +0000
commit1d63948d79ca6f32889656692d6736c9127f2ee1 (patch)
treebb26a34d7c7b62ac30b0d4da15584efe3e2a754a /coverity-scan.sh
parentReleasing debian version 1.13.0-1. (diff)
downloadnetdata-1d63948d79ca6f32889656692d6736c9127f2ee1.tar.xz
netdata-1d63948d79ca6f32889656692d6736c9127f2ee1.zip
Merging upstream version 1.14.0~rc0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'coverity-scan.sh')
-rwxr-xr-xcoverity-scan.sh47
1 files changed, 21 insertions, 26 deletions
diff --git a/coverity-scan.sh b/coverity-scan.sh
index 1bf0a5804..977a2c296 100755
--- a/coverity-scan.sh
+++ b/coverity-scan.sh
@@ -1,10 +1,15 @@
#!/usr/bin/env bash
-# shellcheck disable=SC2235
-
+# Coverity scan script
+#
# To run this script you need to provide API token. This can be done either by:
# - Putting token in ".coverity-token" file
# - Assigning token value to COVERITY_SCAN_TOKEN environment variable
-# Additionally script can install coverity tool on your computer. To do this just set environment variable INSTALL_COVERITY to "true"
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Costa Tsaousis (costa@netdata.cloud)
+# Author : Pawel Krupa (paulfantom)
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
cpus=$(grep -c ^processor </proc/cpuinfo)
[ -z "${cpus}" ] && cpus=1
@@ -16,28 +21,14 @@ if [ -z "${token}" ]; then
exit 1
fi
-# shellcheck disable=SC2230
+export PATH=${PATH}:/opt/coverity/bin/
covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
([ -z "${covbuild}" ] && [ -f .coverity-build ]) && covbuild="$(<.coverity-build)"
if [ -z "${covbuild}" ]; then
- echo "Cannot find 'cov-build' binary in \$PATH."
- if [ "${INSTALL_COVERITY}" != "" ]; then
- echo "Installing coverity..."
- mkdir /tmp/coverity
- curl -SL --data "token=${token}&project=netdata%2Fnetdata" https://scan.coverity.com/download/linux64 > /tmp/coverity_tool.tar.gz
- tar -x -C /tmp/coverity/ -f /tmp/coverity_tool.tar.gz
- sudo mv /tmp/coverity/cov-analysis-linux64-2017.07 /opt/coverity
- export PATH=${PATH}:/opt/coverity/bin/
- # shellcheck disable=SC2230
- covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
- else
- echo "Save command the full filename of cov-build in .coverity-build"
- exit 1
- fi
-fi
-
-if [ ! -x "${covbuild}" ]; then
- echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build"
+ echo >&2 "Cannot find 'cov-build' binary in \$PATH."
+ exit 1
+elif [ ! -x "${covbuild}" ]; then
+ echo >&2 "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build"
exit 1
fi
@@ -45,7 +36,7 @@ version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)"
echo >&2 "Working on netdata version: ${version}"
echo >&2 "Cleaning up old builds..."
-make clean || echo "Nothing to clean"
+make clean || echo >&2 "Nothing to clean"
[ -d "cov-int" ] && rm -rf "cov-int"
@@ -59,9 +50,13 @@ echo >&2 "Compressing data..."
tar czvf netdata-coverity-analysis.tgz cov-int || exit 1
echo >&2 "Sending analysis for version ${version} ..."
-curl --progress-bar --form token="${token}" \
- --form email=costa@tsaousis.gr \
+COVERITY_SUBMIT_RESULT=$(curl --progress-bar --form token="${token}" \
+ --form email=${COVERITY_SCAN_SUBMIT_MAIL} \
--form file=@netdata-coverity-analysis.tgz \
--form version="${version}" \
--form description="netdata, real-time performance monitoring, done right." \
- https://scan.coverity.com/builds?project=netdata%2Fnetdata
+ https://scan.coverity.com/builds?project=${REPOSITORY})
+
+echo ${COVERITY_SUBMIT_RESULT} | grep -q -e 'Build successfully submitted' || echo >&2 "scan results were not pushed to coverity. Message was: ${COVERITY_SUBMIT_RESULT}"
+
+echo >&2 "Coverity scan mechanism completed"