3 # FD.io VPP Coverity build script
5 # Builds VPP with the Coverity wrapper and if successful submits
6 # it to the Coverity scan service for processing.
8 # Several environment variables are needed:
10 # COVERITY_TOKEN The Coverity Scan API token for this project
11 # COVERITY_TOOLS The location of the Coverity tools
13 # The coverity tools can be fetched with:
14 # wget https://scan.coverity.com/download/linux64 \
15 # --post-data "token=${COVERITY_TOKEN}&project=fd.io+VPP" \
16 # -O coverity_tool.tgz
20 token=${COVERITY_TOKEN}
21 email=vpp-committers@lists.fd.io
23 project_encoded="fd.io+VPP"
24 url=https://scan.coverity.com
26 # Cosmetic labels for the Coverity build logs
27 export COV_HOST=$(hostname -f)
30 # Work out where the root and build-root are
31 script_dir=$(readlink -f $(dirname $0))
32 root_dir=$(readlink -f "${script_dir}/../..")
33 build_dir=$(readlink -f "${script_dir}/../../build-root")
35 # Location for Coverity things
36 covdir="${build_dir}/cov-int"
37 COVERITY_TOOLS="${COVERITY_TOOLS-/scratch/cov-analysis-latest}"
39 # Before we run the build, check that we can submit one
40 check=$(curl -s --form project="${project}" \
41 --form token="${token}" "${url}/api/upload_permitted")
42 if [ "${check}" = "Access denied" ]; then
43 echo "Bad token or project name."
46 if [ "${check}" != '{"upload_permitted":true}' ]; then
47 echo "Upload not permitted; stop now..."
51 version=$(git describe)
55 "${COVERITY_TOOLS}/bin/cov-build" --dir "${covdir}" make bootstrap build-coverity
58 # Tar the build artifacts that scan wants
59 tar -czf fd.io-vpp.tgz "$(basename ${covdir})"
63 echo curl --form token="${token}" \
64 --form email="${email}" \
65 --form file=@fd.io-vpp.tgz \
66 --form version="${version}" \
67 --form description="master:${version}" \
68 "${url}/builds?project=${project_encoded}"