Skip to content

Commit 03b8bb0

Browse files
committed
Don't fail build because of coverity
1 parent 76bfdc9 commit 03b8bb0

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

.travis/travis-script.sh

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
44

55
IS_COVERITY_SCAN_BRANCH=`ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0"`
66

7+
export COVERITY_ALLOWED=true
8+
# Verify upload is permitted
9+
AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted`
10+
if [ "$AUTH_RES" = "Access denied" ]; then
11+
echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m"
12+
COVERITY_ALLOWED=false
13+
else
14+
AUTH=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']"`
15+
if [ "$AUTH" = "true" ]; then
16+
echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m"
17+
else
18+
WHEN=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']"`
19+
echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
20+
21+
COVERITY_ALLOWED=false
22+
fi
23+
fi
24+
25+
set -ex
726

827
if [ "${FAST_BUILD}" == "true" ]; then
9-
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$COVERITY" == "true" ] && [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then
28+
if [ "$TRAVIS_PULL_REQUEST" == "false" ] &&
29+
[ "$COVERITY" == "true" ] &&
30+
[ "$IS_COVERITY_SCAN_BRANCH" = "1" ] &&
31+
[ "$COVERITY_ALLOWED" == "true" ]; then
1032
export COVERITY_SCAN_BUILD_COMMAND="mvn package"
1133
#curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash
1234
./.travis/travisci_build_coverity_scan.sh
1335
else
1436
mvn package
1537
fi
1638
else
17-
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$COVERITY" == "true" ] && [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then
39+
if [ "$TRAVIS_PULL_REQUEST" == "false" ] &&
40+
[ "$COVERITY" == "true" ] &&
41+
[ "$IS_COVERITY_SCAN_BRANCH" = "1" ] &&
42+
[ "$COVERITY_ALLOWED" == "true" ]; then
1843
export COVERITY_SCAN_BUILD_COMMAND="mvn verify"
1944
#curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash
2045
./.travis/travisci_build_coverity_scan.sh

0 commit comments

Comments
 (0)