diff options
author | rghetia <rghetia@yahoo.com> | 2018-05-24 12:11:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 12:11:58 -0700 |
commit | 59ab1c2acde80ff86cff22906c879594b3684053 (patch) | |
tree | e4c90bdaee348d860769985781faa70f6937c29f /buildscripts | |
parent | 07ad48d7c3031efcdd6ac3c8932cabe6ac3fff5b (diff) | |
download | opencensus-java-59ab1c2acde80ff86cff22906c879594b3684053.tar.gz |
Run codecov reporting only if running as part of kokoro build. (#1210)
Diffstat (limited to 'buildscripts')
-rwxr-xr-x | buildscripts/kokoro/linux_presubmit.sh | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/buildscripts/kokoro/linux_presubmit.sh b/buildscripts/kokoro/linux_presubmit.sh index fa0d0627..11785d0e 100755 --- a/buildscripts/kokoro/linux_presubmit.sh +++ b/buildscripts/kokoro/linux_presubmit.sh @@ -43,16 +43,22 @@ case "$TASK" in ./gradlew check :opencensus-all:jacocoTestReport ./gradlew verGJF - # Get token from file located at - # $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token - if [ -f $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token ] ; then - export CODECOV_TOKEN=`cat $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token` + # Run codecoverage reporting only if the script is running + # as a part of KOKORO BUILD. If it is outside of kokoro + # then there is no access to the codecov token and hence + # there is no point in running it. + if [[ -v KOKORO_BUILD_NUMBER ]]; then + # Get token from file located at + # $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token + if [ -f $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token ] ; then + curl -s https://codecov.io/bash | bash -s -- -Z -t @$KOKORO_KEYSTORE_DIR/73495_codecov-auth-token + else + echo "Codecov token file not found" + exit 1 + fi + else + echo "Skipping codecov reporting" fi - if [[ ! -v CODECOV_TOKEN ]]; then - echo "Environment variable CODECOV_TOKEN not set" - exit 1 - fi - curl -s https://codecov.io/bash | bash ;; "CHECKER_FRAMEWORK") ./gradlew clean assemble -PcheckerFramework=true |