@cryptotaxi247 / netdata-1 / commits / f2d6af0ee

Fix Coverity scan CI. (#18024)

* Fix Coverity scan CI. - Bail early in the script if the system isn’t 64-bit x86 Linux, since it doesn’t actually work elsewhere. - If a specific version of the Coverity tools was not specified, use whatever version we end up with instead of failing. This means that the CI will _just work_ instead of needing to be updated every few months because the Coverity team does not understand the concept of providing properly versioned download links. * Fix typo.

Austin S. Hemmelgarn committed Jun 28, 2024 at 08:09 UTC f2d6af0ee53d0021d5c4a7208729c71d952d502e
1 file changed +14 -6
packaging/utils/coverity-scan.sh
+14 -6
@@ -37,10 +37,12 @@
37
38 set -e
39
40 -INSTALL_DIR="/opt"
40 +if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then
41 + echo "This script can only be used on a 64-bit x86 Linux system."
42 + exit 1
43 +fi
44
42 -# the version of coverity to use
43 -COVERITY_BUILD_VERSION="${COVERITY_BUILD_VERSION:-cov-analysis-linux64-2023.6.2}"
45 +INSTALL_DIR="/opt"
46
47 SCRIPT_SOURCE="$(
48 self=${0}
@@ -165,12 +167,18 @@ installit() {
167
168 debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64
169
168 - if [ -f "${COVERITY_BUILD_VERSION}.tar.gz" ]; then
170 + if [ -z "${COVERITY_BUILD_VERSION}" ]; then
171 + COVERITY_ARCHIVE="$(find "${TMP_DIR}" -maxdepth 0 -name 'cov-analysis-linux64-*.tar.gz' | cut -f 2 -d '/' | head -n 1)"
172 + else
173 + COVERITY_ARCHIVE="${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz"
174 + fi
175 +
176 + if [ -f "${COVERITY_ARCHIVE}" ]; then
177 progress "Installing coverity..."
178 cd "${INSTALL_DIR}"
179
172 - run sudo tar -z -x -f "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz" || exit 1
173 - rm "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz"
180 + run sudo tar -z -x -f "${COVERITY_ARCHIVE}" || exit 1
181 + rm -f "${COVERITY_ARCHIVE}"
182 COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*')
183 export PATH=${PATH}:${COVERITY_PATH}/bin/
184 elif find . -name "*.tar.gz" > /dev/null 2>&1; then