diff --git a/.travis.yml b/.travis.yml index c9756f3f..ff6aeef9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,10 @@ language: java + +before_script: +- chmod +x ./check_coverity_authorization.sh +- branch_name=`./check_coverity_authorization.sh` +- echo $branch_name + script: mvn clean package after_success: @@ -21,4 +27,4 @@ addons: description: "Build submitted via Travis CI" notification_email: maciej.majchrzak@cognifide.com build_command: "mvn clean package" - branch_pattern: master \ No newline at end of file + branch_pattern: $branch_name \ No newline at end of file diff --git a/check_coverity_authorization.sh b/check_coverity_authorization.sh new file mode 100644 index 00000000..99021613 --- /dev/null +++ b/check_coverity_authorization.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -ev + +AUTH_RES=`curl -s --form project="Cognifide/Slice" --form token="$COVERITY_SCAN_TOKEN" https://scan.coverity.com/api/upload_permitted` +AUTH=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']"` + +if [ "$AUTH" = "true" ]; then + echo "master" +else + echo "non_existing_branch_name" +fi + + + + + +