2017-12-26 07:15:26 +02:00
|
|
|
#!/usr/bin/env bash
|
2024-12-20 15:25:45 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# shellcheck disable=SC1091,SC2230,SC2086
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
#
|
netdata/build: A small house keeping around coverity scan (no functional or process change) (#5656)
* netdata/build: a small house keeping around coverity scan (no functional or process change)
1) Split coverity install on seperate scriptlet, call it through travis when needed
2) Remove shellcheck exclussions, they dont seem to be raised any more (i might be using wrong version of shellcheck, will see)
3) Fix authors,copyrights etc
4) Make sure all echo goes to stderr
5) When installing, use mktemp for the temporary directory and put everything there. Remove afterwards
* netdata/build: missed - remove temp folder once done
* Rebumping with empty commit to trigger build
* Temp commit to force execution of modified code for coverity
* [ci skip] Revert "Temp commit to force execution of modified code for coverity"
This reverts commit 70e770cbbcb2b9cb4c8040d6249688c810d823f3.
* Temp commit to force execution of modified code for coverity
* Temp commit to force execution of modified code for coverity
* packaging/netdata/coverity-scan: Missed PATH export during scan phase
* netdata/packaging/coverity-scan: the source folder not so temporary after all
Use a more permanent path for the workdir and we will deep dive on the details of this if necessary at a later stage
* netdata/packaging: This is a more general change, push REPOSITORY variable up to travis layer to help testing against personal accounts
* netdata/packaging/coverity-scan: Missed folder creation (no longer using mktemp, duh), also make sure you do a couple of validations so that you know install is failed or not, otherwise we exit with success but nothing has happened
* netdata/coverity-scan: a few more changes towards abstraction
1) move for submit email to travis environment variables
2) Use REPOSITORY in project name
3) Add some new lines on the last log message, to separate it from the curl result
* netdata/coverity: missed parameter from echo
* Reinstate the flag that controls coverity scan execution (was removed for testing purposes, to run coverity in a controlled environment)
* netdata/coverity-scan: Control coverity scan results submission and report back the potential error without blocking the pipeline by failing the step completely
2019-03-19 18:22:38 +01:00
|
|
|
# Coverity scan script
|
|
|
|
#
|
2019-08-31 21:10:53 +03:00
|
|
|
# To run manually, save configuration to .coverity-scan.conf like this:
|
|
|
|
#
|
|
|
|
# the repository to report to coverity - devs can set here their own fork
|
|
|
|
# REPOSITORY="netdata/netdata"
|
|
|
|
#
|
|
|
|
# the email of the developer, as given to coverity
|
|
|
|
# COVERITY_SCAN_SUBMIT_MAIL="you@example.com"
|
|
|
|
#
|
|
|
|
# the token given by coverity to the developer
|
|
|
|
# COVERITY_SCAN_TOKEN="TOKEN taken from Coverity site"
|
|
|
|
#
|
|
|
|
# the absolute path of the cov-build - optional
|
2022-03-14 10:44:30 -04:00
|
|
|
# COVERITY_BUILD_PATH="/opt/cov-analysis-linux64-2021.12/bin/cov-build"
|
2019-08-31 21:10:53 +03:00
|
|
|
#
|
|
|
|
# when set, the script will print on screen the curl command that submits the build to coverity
|
|
|
|
# this includes the token, so the default is not to print it.
|
|
|
|
# COVERITY_SUBMIT_DEBUG=1
|
|
|
|
#
|
|
|
|
# All these variables can also be exported before running this script.
|
|
|
|
#
|
|
|
|
# If the first parameter of this script is "install",
|
|
|
|
# coverity build tools will be downloaded and installed in /opt/coverity
|
|
|
|
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
set -e
|
|
|
|
|
2024-06-28 08:09:08 -04:00
|
|
|
if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then
|
|
|
|
echo "This script can only be used on a 64-bit x86 Linux system."
|
|
|
|
exit 1
|
|
|
|
fi
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
|
2024-06-28 08:09:08 -04:00
|
|
|
INSTALL_DIR="/opt"
|
2019-08-31 21:10:53 +03:00
|
|
|
|
2024-02-14 07:01:52 -05:00
|
|
|
SCRIPT_SOURCE="$(
|
|
|
|
self=${0}
|
|
|
|
while [ -L "${self}" ]
|
|
|
|
do
|
|
|
|
cd "${self%/*}" || exit 1
|
|
|
|
self=$(readlink "${self}")
|
|
|
|
done
|
|
|
|
cd "${self%/*}" || exit 1
|
|
|
|
echo "$(pwd -P)/${self##*/}"
|
|
|
|
)"
|
2024-02-16 11:58:31 -05:00
|
|
|
REPO_ROOT="$(dirname "${SCRIPT_SOURCE}")/../.."
|
2024-02-14 07:01:52 -05:00
|
|
|
|
|
|
|
. "${REPO_ROOT}/packaging/installer/functions.sh"
|
2019-08-31 21:10:53 +03:00
|
|
|
|
2024-01-08 08:40:41 -05:00
|
|
|
JOBS=$(find_processors)
|
|
|
|
[ -z "${JOBS}" ] && JOBS=1
|
|
|
|
|
|
|
|
if command -v ninja 2>&1; then
|
|
|
|
ninja="$(command -v ninja)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
CMAKE_OPTS="${ninja:+-G Ninja}"
|
|
|
|
BUILD_OPTS="VERBOSE=1"
|
|
|
|
[ -n "${ninja}" ] && BUILD_OPTS="-v"
|
2024-01-15 08:31:47 -05:00
|
|
|
NETDATA_BUILD_DIR="${NETDATA_BUILD_DIR:-./build/}"
|
2017-06-18 01:56:13 +03:00
|
|
|
|
2020-03-13 07:24:06 +10:00
|
|
|
if [ -f ".coverity-scan.conf" ]; then
|
|
|
|
source ".coverity-scan.conf"
|
2019-08-31 21:10:53 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
repo="${REPOSITORY}"
|
|
|
|
if [ -z "${repo}" ]; then
|
2020-03-13 07:24:06 +10:00
|
|
|
fatal "export variable REPOSITORY or set it in .coverity-scan.conf"
|
2019-08-31 21:10:53 +03:00
|
|
|
fi
|
|
|
|
repo="${repo//\//%2F}"
|
|
|
|
|
|
|
|
email="${COVERITY_SCAN_SUBMIT_MAIL}"
|
|
|
|
if [ -z "${email}" ]; then
|
2020-03-13 07:24:06 +10:00
|
|
|
fatal "export variable COVERITY_SCAN_SUBMIT_MAIL or set it in .coverity-scan.conf"
|
2019-08-31 21:10:53 +03:00
|
|
|
fi
|
|
|
|
|
2018-09-10 02:02:16 +03:00
|
|
|
token="${COVERITY_SCAN_TOKEN}"
|
2018-09-24 19:42:19 +02:00
|
|
|
if [ -z "${token}" ]; then
|
2020-03-13 07:24:06 +10:00
|
|
|
fatal "export variable COVERITY_SCAN_TOKEN or set it in .coverity-scan.conf"
|
2018-09-24 19:42:19 +02:00
|
|
|
fi
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2020-03-13 07:24:06 +10:00
|
|
|
if ! command -v curl > /dev/null 2>&1; then
|
|
|
|
fatal "CURL is required for coverity scan to work"
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
fi
|
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
# only print the output of a command
|
|
|
|
# when debugging is enabled
|
|
|
|
# used to hide the token when debugging is not enabled
|
|
|
|
debugrun() {
|
2020-03-13 07:24:06 +10:00
|
|
|
if [ "${COVERITY_SUBMIT_DEBUG}" = "1" ]; then
|
2019-08-31 21:10:53 +03:00
|
|
|
run "${@}"
|
|
|
|
return $?
|
|
|
|
else
|
|
|
|
"${@}"
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
scanit() {
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
progress "Scanning using coverity"
|
2022-05-26 22:55:29 +03:00
|
|
|
COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*')
|
|
|
|
export PATH=${PATH}:${COVERITY_PATH}/bin/
|
2019-08-31 21:10:53 +03:00
|
|
|
covbuild="${COVERITY_BUILD_PATH}"
|
2020-03-13 07:24:06 +10:00
|
|
|
[ -z "${covbuild}" ] && covbuild="$(which cov-build 2> /dev/null || command -v cov-build 2> /dev/null)"
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
if [ -z "${covbuild}" ]; then
|
|
|
|
fatal "Cannot find 'cov-build' binary in \$PATH. Export variable COVERITY_BUILD_PATH or set it in .coverity-scan.conf"
|
|
|
|
elif [ ! -x "${covbuild}" ]; then
|
|
|
|
fatal "The command '${covbuild}' is not executable. Export variable COVERITY_BUILD_PATH or set it in .coverity-scan.conf"
|
|
|
|
fi
|
|
|
|
|
2024-02-14 07:01:52 -05:00
|
|
|
cd "${REPO_ROOT}" || exit 1
|
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)"
|
|
|
|
progress "Working on netdata version: ${version}"
|
|
|
|
|
|
|
|
progress "Cleaning up old builds..."
|
2024-01-08 08:40:41 -05:00
|
|
|
rm -rf "${NETDATA_BUILD_DIR}"
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
[ -d "cov-int" ] && rm -rf "cov-int"
|
2017-03-18 19:40:18 +02:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
[ -f netdata-coverity-analysis.tgz ] && run rm netdata-coverity-analysis.tgz
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
progress "Configuring netdata source..."
|
2024-01-08 08:40:41 -05:00
|
|
|
USE_SYSTEM_PROTOBUF=1
|
2024-02-26 09:10:14 -05:00
|
|
|
ENABLE_GO=0
|
2024-01-08 08:40:41 -05:00
|
|
|
prepare_cmake_options
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
|
2024-01-08 08:40:41 -05:00
|
|
|
run cmake ${NETDATA_CMAKE_OPTIONS}
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
progress "Analyzing netdata..."
|
2024-01-08 08:40:41 -05:00
|
|
|
run "${covbuild}" --dir cov-int cmake --build "${NETDATA_BUILD_DIR}" --parallel ${JOBS} -- ${BUILD_OPTS}
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
echo >&2 "Compressing analysis..."
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
run tar czvf netdata-coverity-analysis.tgz cov-int
|
2016-09-30 00:45:29 +03:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
echo >&2 "Sending analysis to coverity for netdata version ${version} ..."
|
|
|
|
COVERITY_SUBMIT_RESULT=$(debugrun curl --progress-bar \
|
|
|
|
--form token="${token}" \
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
--form email="${email}" \
|
2019-08-31 21:10:53 +03:00
|
|
|
--form file=@netdata-coverity-analysis.tgz \
|
|
|
|
--form version="${version}" \
|
|
|
|
--form description="netdata, monitor everything, in real-time." \
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
https://scan.coverity.com/builds?project="${repo}")
|
netdata/build: A small house keeping around coverity scan (no functional or process change) (#5656)
* netdata/build: a small house keeping around coverity scan (no functional or process change)
1) Split coverity install on seperate scriptlet, call it through travis when needed
2) Remove shellcheck exclussions, they dont seem to be raised any more (i might be using wrong version of shellcheck, will see)
3) Fix authors,copyrights etc
4) Make sure all echo goes to stderr
5) When installing, use mktemp for the temporary directory and put everything there. Remove afterwards
* netdata/build: missed - remove temp folder once done
* Rebumping with empty commit to trigger build
* Temp commit to force execution of modified code for coverity
* [ci skip] Revert "Temp commit to force execution of modified code for coverity"
This reverts commit 70e770cbbcb2b9cb4c8040d6249688c810d823f3.
* Temp commit to force execution of modified code for coverity
* Temp commit to force execution of modified code for coverity
* packaging/netdata/coverity-scan: Missed PATH export during scan phase
* netdata/packaging/coverity-scan: the source folder not so temporary after all
Use a more permanent path for the workdir and we will deep dive on the details of this if necessary at a later stage
* netdata/packaging: This is a more general change, push REPOSITORY variable up to travis layer to help testing against personal accounts
* netdata/packaging/coverity-scan: Missed folder creation (no longer using mktemp, duh), also make sure you do a couple of validations so that you know install is failed or not, otherwise we exit with success but nothing has happened
* netdata/coverity-scan: a few more changes towards abstraction
1) move for submit email to travis environment variables
2) Use REPOSITORY in project name
3) Add some new lines on the last log message, to separate it from the curl result
* netdata/coverity: missed parameter from echo
* Reinstate the flag that controls coverity scan execution (was removed for testing purposes, to run coverity in a controlled environment)
* netdata/coverity-scan: Control coverity scan results submission and report back the potential error without blocking the pipeline by failing the step completely
2019-03-19 18:22:38 +01:00
|
|
|
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
echo "${COVERITY_SUBMIT_RESULT}" | grep -q -e 'Build successfully submitted' || echo >&2 "scan results were not pushed to coverity. Message was: ${COVERITY_SUBMIT_RESULT}"
|
netdata/build: A small house keeping around coverity scan (no functional or process change) (#5656)
* netdata/build: a small house keeping around coverity scan (no functional or process change)
1) Split coverity install on seperate scriptlet, call it through travis when needed
2) Remove shellcheck exclussions, they dont seem to be raised any more (i might be using wrong version of shellcheck, will see)
3) Fix authors,copyrights etc
4) Make sure all echo goes to stderr
5) When installing, use mktemp for the temporary directory and put everything there. Remove afterwards
* netdata/build: missed - remove temp folder once done
* Rebumping with empty commit to trigger build
* Temp commit to force execution of modified code for coverity
* [ci skip] Revert "Temp commit to force execution of modified code for coverity"
This reverts commit 70e770cbbcb2b9cb4c8040d6249688c810d823f3.
* Temp commit to force execution of modified code for coverity
* Temp commit to force execution of modified code for coverity
* packaging/netdata/coverity-scan: Missed PATH export during scan phase
* netdata/packaging/coverity-scan: the source folder not so temporary after all
Use a more permanent path for the workdir and we will deep dive on the details of this if necessary at a later stage
* netdata/packaging: This is a more general change, push REPOSITORY variable up to travis layer to help testing against personal accounts
* netdata/packaging/coverity-scan: Missed folder creation (no longer using mktemp, duh), also make sure you do a couple of validations so that you know install is failed or not, otherwise we exit with success but nothing has happened
* netdata/coverity-scan: a few more changes towards abstraction
1) move for submit email to travis environment variables
2) Use REPOSITORY in project name
3) Add some new lines on the last log message, to separate it from the curl result
* netdata/coverity: missed parameter from echo
* Reinstate the flag that controls coverity scan execution (was removed for testing purposes, to run coverity in a controlled environment)
* netdata/coverity-scan: Control coverity scan results submission and report back the potential error without blocking the pipeline by failing the step completely
2019-03-19 18:22:38 +01:00
|
|
|
|
2019-08-31 21:10:53 +03:00
|
|
|
progress "Coverity scan completed"
|
|
|
|
}
|
|
|
|
|
|
|
|
installit() {
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
TMP_DIR="$(mktemp -d /tmp/netdata-coverity-scan-XXXXX)"
|
|
|
|
progress "Downloading coverity in ${TMP_DIR}..."
|
2024-07-15 06:56:03 -04:00
|
|
|
(cd "${TMP_DIR}" && debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64)
|
2019-08-31 21:10:53 +03:00
|
|
|
|
2024-07-15 06:56:03 -04:00
|
|
|
COVERITY_ARCHIVE="$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -name 'cov-analysis-linux64-*.tar.gz')"
|
2019-08-31 21:10:53 +03:00
|
|
|
|
2024-07-15 06:56:03 -04:00
|
|
|
if [ -n "${COVERITY_ARCHIVE}" ] && [ -f "${COVERITY_ARCHIVE}" ]; then
|
2019-08-31 21:10:53 +03:00
|
|
|
progress "Installing coverity..."
|
2024-07-15 06:56:03 -04:00
|
|
|
run sudo tar -z -x -f "${COVERITY_ARCHIVE}" -C "${INSTALL_DIR}"
|
2024-06-28 08:09:08 -04:00
|
|
|
rm -f "${COVERITY_ARCHIVE}"
|
2022-05-26 22:55:29 +03:00
|
|
|
COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*')
|
2024-07-15 06:56:03 -04:00
|
|
|
export PATH="${PATH}:${COVERITY_PATH}/bin/"
|
|
|
|
elif find "${TMP_DIR}" -name "*.tar.gz" > /dev/null 2>&1; then
|
|
|
|
ls "${TMP_DIR}"/*.tar.gz
|
|
|
|
fatal "Downloaded coverity tool tarball does not appear to be the file-name we were expecting, exiting."
|
2019-08-31 21:10:53 +03:00
|
|
|
else
|
|
|
|
fatal "Failed to download coverity tool tarball!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Validate the installation
|
2020-03-13 07:24:06 +10:00
|
|
|
covbuild="$(which cov-build 2> /dev/null || command -v cov-build 2> /dev/null)"
|
2019-08-31 21:10:53 +03:00
|
|
|
if [ -z "$covbuild" ]; then
|
|
|
|
fatal "Failed to install coverity."
|
|
|
|
fi
|
|
|
|
|
|
|
|
progress "Coverity scan tools are installed."
|
2022-03-30 12:32:58 -04:00
|
|
|
|
|
|
|
# Clean temp directory
|
|
|
|
[ -n "${TMP_DIR}" ] && rm -rf "${TMP_DIR}"
|
2019-08-31 21:10:53 +03:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
FOUND_OPTS="NO"
|
|
|
|
while [ -n "${1}" ]; do
|
2020-03-13 07:24:06 +10:00
|
|
|
if [ "${1}" = "--with-install" ]; then
|
|
|
|
progress "Running coverity install"
|
|
|
|
installit
|
|
|
|
shift 1
|
|
|
|
elif [ -n "${1}" ]; then
|
|
|
|
# Clear the default arguments, once you bump into the first argument
|
|
|
|
if [ "${FOUND_OPTS}" = "NO" ]; then
|
|
|
|
OTHER_OPTIONS="${1}"
|
|
|
|
FOUND_OPTS="YES"
|
|
|
|
else
|
|
|
|
OTHER_OPTIONS+=" ${1}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
shift 1
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
netdata/ci: second batch of fixes for coverity scan script and others (#6804)
* netdata/ci: fine grain coverity scan toolkit
1) Deprecate coverity-install.sh
2) add set -e to raise errors more aggressively when something is wrong
3) refactor some variable definitions for temp and install paths, use mktemp and clean up temp dir when all ok
* netdata/ci: reduce the scope
* netdata/ci: require curl
* netdata/ci: go soft on functions loading
* netdata/ci: allow override of build version without touching the script
* netdata/ci: handle shellcheck errors, some were silenced because we dont handle them
* netdata/ci: coverity scan, parse any extra options other than --with-install and pass them to configure
1) add default configure arguments if no extras are given
2) parse all possible arguments individually, handle --with-install and pass the rest to scanit
* netdata/ci: focus, argument parsing in one place a bit more consistently
* netdata/ci: prepare for using
* netdata/ci: coverity - add more flags, adjust deps list
1) Add with math and with zlib flags on the script
2) add xenstat dependencies
3) run in coverity with custom flags, so that we add xenstat (no need to be by default for the users of the script)
* netdata/packaging: add xen-utils also
* test the flow
* netdata/ci: dont forget to go back to the original directory
* netdata/ci: please, travis, stop it
* netdata/ci: how about this then
* netdata/ci: silence that, we cant call it otherwise
* netdata/packaging: update documentation around xenstat on centos
* netdata/packaging: dont enable xenstat at this stage
* netdata/ci: add += instead of variable reusage
2019-09-12 12:49:21 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
echo "Running coverity scan with extra options ${OTHER_OPTIONS}"
|
|
|
|
scanit "${OTHER_OPTIONS}"
|