blob: 6e2c405a16a2b81e3417de66b2c4ca4d2bd2ad7f [file] [log] [blame]
Dave Barach3ad77042017-01-04 17:24:32 -05001#!/bin/bash
2
3set -ex
4
5token=${COVERITY_TOKEN}
6email=dbarach@cisco.com
7project="fd.io VPP"
8project_encoded="fd.io+VPP"
9url=https://scan.coverity.com
10
11export COV_HOST=$(hostname -f)
12export COV_USER=vpp
13
14# Location of various directories
15
16# run script from .../build-root
17
18build_dir=`pwd`
19covdir="${build_dir}/cov-int"
20COVTOOLS="${COVTOOLS-/scratch/cov-analysis-latest}"
21
22# Before we run the build, check that we can submit one
23check=$(curl -s --form project="${project}" \
24 --form token="${token}" "${url}/api/upload_permitted")
25if [ "${check}" = "Access denied" ]; then
26 echo "Bad token or project name."
27 exit 1
28fi
29if [ "${check}" != '{"upload_permitted":true}' ]; then
30 echo "Upload not permitted; stop now..."
31 exit 1
32fi
33
34version=$(git describe)
35
36# Run the build
37cd ..
38"${COVTOOLS}/bin/cov-build" --dir "${covdir}" make bootstrap build-coverity
39cd ${build_dir}
40
41# Tar the build artifacts that scan wants
42tar -czf fd.io-vpp.tgz "$(basename ${covdir})"
43# rm -rf "${covdir}"
44
45# Submit the build
46echo curl --form token="${token}" \
47 --form email="${email}" \
48 --form file=@fd.io-vpp.tgz \
49 --form version="${version}" \
50 --form description="master:${version}" \
51 "${url}/builds?project=${project_encoded}"
52
53# All done!