Skip to content

Commit 18c18e3

Browse files
committed
coverity: check for Coverity token only if necessary
When running a Coverity build, we have to provide an authentication token in order to proof that we are actually allowed to run analysis in the name of a certain project. As this token should be secret, it is only set on the main repository, so when we were requested to run the Coverity script on another repository we do error out. But in fact we do also error out if the Coverity analysis should _not_ be run if there is no authentication token provided. Fix the issue by only checking for the authentication token after determining if analysis is indeed requested.
1 parent 561276e commit 18c18e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

script/coverity.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash
22
set -e
33

4-
# Environment check
5-
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
6-
74
# Only run this on our branches
85
echo "Branch: $TRAVIS_BRANCH | Pull request: $TRAVIS_PULL_REQUEST | Slug: $TRAVIS_REPO_SLUG"
96
if [ "$TRAVIS_BRANCH" != "master" -o "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "libgit2/libgit2" ];
@@ -12,6 +9,9 @@ then
129
exit 0
1310
fi
1411

12+
# Environment check
13+
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
14+
1515
case $(uname -m) in
1616
i?86) BITS=32 ;;
1717
amd64|x86_64) BITS=64 ;;

0 commit comments

Comments
 (0)