diff --git a/.kokoro/build.sh b/.kokoro/build.sh index ecdd0a3ea514..1badebcebd69 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,16 +360,24 @@ case ${JOB_TYPE} in esac -if [ "${REPORT_COVERAGE}" == "true" ]; then - bash ${KOKORO_GFILE_DIR}/codecov.sh +if [[ "${REPORT_COVERAGE}" == "true" ]]; then + if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/codecov.sh" ]]; then + bash "${KOKORO_GFILE_DIR}/codecov.sh" + else + echo "Warning: REPORT_COVERAGE is true, but codecov.sh was not found in KOKORO_GFILE_DIR." + fi fi # fix output location of logs bash .kokoro/coerce_logs.sh if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java + if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then + chmod +x "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" || true + "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" -repo=googleapis/google-cloud-java + else + echo "Warning: ENABLE_FLAKYBOT is true, but flakybot binary was not found in KOKORO_GFILE_DIR." + fi fi echo "exiting with ${RETURN_CODE}"