diff options
-rw-r--r-- | shell/maven-coverity.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/shell/maven-coverity.sh b/shell/maven-coverity.sh index 739754211..76ba4239f 100644 --- a/shell/maven-coverity.sh +++ b/shell/maven-coverity.sh @@ -20,6 +20,31 @@ PS4='+['$(readlink -f "$0")' ${FUNCNAME[0]%main}#$LINENO] ' echo '---> maven-coverity.sh' #----------------------------------------------------------------------------- +# Check if we are allowed to submit results to Coverity Scan service +# and have not exceeded our upload quota limits +# See also: https://scan.coverity.com/faq#frequency + +CURL_OUTPUT=$( + curl \ + --verbose \ + --silent \ + --show-error \ + --fail \ + --form "project=${COVERITY_PROJECT_NAME}" \ + --form "token=${COVERITY_TOKEN}" \ + 'https://scan.coverity.com/api/upload_permitted' +) + +IS_COVERITY_UPLOAD_PERMITTED=$( + echo "${CURL_OUTPUT}" \ + | jq '.upload_permitted' +) +if [ x"${IS_COVERITY_UPLOAD_PERMITTED}" != x'true' ]; then + echo "Upload quota reached. Next upload permitted at "$(echo "${CURL_OUTPUT}" | jq '.next_upload_permitted_at') >&2 + exit 1 +fi + +#----------------------------------------------------------------------------- # Get Coverity Scan build tool curl \ |