Commit 18c18e3d by Patrick Steinhardt

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.
parent 561276ee
#!/bin/bash #!/bin/bash
set -e set -e
# Environment check
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
# Only run this on our branches # Only run this on our branches
echo "Branch: $TRAVIS_BRANCH | Pull request: $TRAVIS_PULL_REQUEST | Slug: $TRAVIS_REPO_SLUG" echo "Branch: $TRAVIS_BRANCH | Pull request: $TRAVIS_PULL_REQUEST | Slug: $TRAVIS_REPO_SLUG"
if [ "$TRAVIS_BRANCH" != "master" -o "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "libgit2/libgit2" ]; if [ "$TRAVIS_BRANCH" != "master" -o "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "libgit2/libgit2" ];
...@@ -12,6 +9,9 @@ then ...@@ -12,6 +9,9 @@ then
exit 0 exit 0
fi fi
# Environment check
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
case $(uname -m) in case $(uname -m) in
i?86) BITS=32 ;; i?86) BITS=32 ;;
amd64|x86_64) BITS=64 ;; amd64|x86_64) BITS=64 ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment