forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add local Coverity Scan build option (envoyproxy#1775)
See ci/README.md for instructions. Signed-off-by: David Mackey [email protected]
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
# | ||
# do_coverity_local.sh | ||
# | ||
# This script builds Envoy with the Coverity Scan Built Tool. | ||
# | ||
# It expects the following environment variables to be set: | ||
# COVERITY_TOKEN - set to the user's Coverity Scan project token. | ||
# COVERITY_USER_EMAIL - set to the email address used with the Coverity account. | ||
# defaults to the local git config user.email. | ||
|
||
|
||
set -e | ||
|
||
. ./ci/envoy_build_sha.sh | ||
|
||
[[ -z "${ENVOY_DOCKER_BUILD_DIR}" ]] && ENVOY_DOCKER_BUILD_DIR=/tmp/envoy-docker-build | ||
mkdir -p "${ENVOY_DOCKER_BUILD_DIR}" | ||
|
||
TEST_TYPE="bazel.coverity" | ||
COVERITY_USER_EMAIL="${COVERITY_USER_EMAIL:-$(git config user.email)}" | ||
COVERITY_OUTPUT_FILE="${ENVOY_DOCKER_BUILD_DIR}"/envoy/source/exe/envoy-coverity-output.tgz | ||
|
||
if [ -n "${COVERITY_TOKEN}" ] | ||
then | ||
pushd "${ENVOY_DOCKER_BUILD_DIR}" | ||
rm -rf cov-analysis | ||
wget https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_TOKEN}&project=Envoy+Proxy" -O coverity_tool.tgz | ||
tar xvf coverity_tool.tgz | ||
mv cov-analysis-linux* cov-analysis | ||
popd | ||
else | ||
echo "ERROR: COVERITY_TOKEN is required to download and run Coverity Scan." | ||
exit 1 | ||
fi | ||
|
||
ci/run_envoy_docker.sh "ci/do_ci.sh ${TEST_TYPE}" | ||
|
||
# Check the artifact size as an approximation for determining if the scan tool was successful. | ||
if [[ $(find "${COVERITY_OUTPUT_FILE}" -type f -size +256M 2>/dev/null) ]] | ||
then | ||
echo "Uploading Coverity Scan build" | ||
curl \ | ||
--form token="${COVERITY_TOKEN}" \ | ||
--form email="${COVERITY_USER_EMAIL}" \ | ||
--form file=@"${COVERITY_OUTPUT_FILE}" \ | ||
--form version="${ENVOY_BUILD_SHA}" \ | ||
--form description="Envoy Proxy Build ${ENVOY_BUILD_SHA}" \ | ||
https://scan.coverity.com/builds?project=Envoy+Proxy | ||
else | ||
echo "Coverity Scan output file appears to be too small." | ||
echo "Not submitting build for analysis." | ||
exit 1 | ||
fi |