From 7abd102bae86c8043d11b3b4856124b0b9e15b04 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 19:37:48 +0000 Subject: [PATCH 1/7] chore(kokoro): handle missing flakybot and codecov scripts gracefully Kokoro integration jobs often share common install configurations. When run in jobs that don't declare gfile_resources for flakybot and codecov.sh (like directpath or java8), the build.sh script would fail when attempting to chmod or run these missing files. This adds existence checks before execution. --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index ecdd0a3ea514..26f2a5f49ab8 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,14 +360,14 @@ case ${JOB_TYPE} in esac -if [ "${REPORT_COVERAGE}" == "true" ]; then +if [ "${REPORT_COVERAGE}" == "true" ] && [ -f "${KOKORO_GFILE_DIR}/codecov.sh" ]; then bash ${KOKORO_GFILE_DIR}/codecov.sh fi # fix output location of logs bash .kokoro/coerce_logs.sh -if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then +if [[ "${ENABLE_FLAKYBOT}" == "true" ]] && [[ -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java fi From 0d9a0335130ef1a22a3eb758ed37a7f7b8aa23e7 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 19:50:08 +0000 Subject: [PATCH 2/7] Addressed comments --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 26f2a5f49ab8..b36a3b923d21 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,14 +360,14 @@ case ${JOB_TYPE} in esac -if [ "${REPORT_COVERAGE}" == "true" ] && [ -f "${KOKORO_GFILE_DIR}/codecov.sh" ]; then +if [[ "${REPORT_COVERAGE}" == "true" ]] && [[ -n "${KOKORO_GFILE_DIR:-}" ]] && [[ -f "${KOKORO_GFILE_DIR}/codecov.sh" ]]; then bash ${KOKORO_GFILE_DIR}/codecov.sh fi # fix output location of logs bash .kokoro/coerce_logs.sh -if [[ "${ENABLE_FLAKYBOT}" == "true" ]] && [[ -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then +if [[ "${ENABLE_FLAKYBOT}" == "true" ]] && [[ -n "${KOKORO_GFILE_DIR:-}" ]] && [[ -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java fi From 25fe1b6e5d2ca04aed5ddb618c2948e89ec4a0d0 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 20:01:21 +0000 Subject: [PATCH 3/7] Addressed comments --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index b36a3b923d21..a8f1a4d2740d 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,14 +360,14 @@ case ${JOB_TYPE} in esac -if [[ "${REPORT_COVERAGE}" == "true" ]] && [[ -n "${KOKORO_GFILE_DIR:-}" ]] && [[ -f "${KOKORO_GFILE_DIR}/codecov.sh" ]]; then +if [[ "${REPORT_COVERAGE}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR}/codecov.sh" ]]; then bash ${KOKORO_GFILE_DIR}/codecov.sh fi # fix output location of logs bash .kokoro/coerce_logs.sh -if [[ "${ENABLE_FLAKYBOT}" == "true" ]] && [[ -n "${KOKORO_GFILE_DIR:-}" ]] && [[ -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then +if [[ "${ENABLE_FLAKYBOT}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java fi From 66cd932c76f5fc47aa15b91e06f49766c234dc27 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 20:12:34 +0000 Subject: [PATCH 4/7] Addressed comments --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index a8f1a4d2740d..66ba4a17849b 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,14 +360,14 @@ case ${JOB_TYPE} in esac -if [[ "${REPORT_COVERAGE}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR}/codecov.sh" ]]; then +if [[ "${REPORT_COVERAGE}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/codecov.sh" ]]; then bash ${KOKORO_GFILE_DIR}/codecov.sh fi # fix output location of logs bash .kokoro/coerce_logs.sh -if [[ "${ENABLE_FLAKYBOT}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" ]]; then +if [[ "${ENABLE_FLAKYBOT}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java fi From e9b1dd1261c46d267076399c9ffee168f48a585f Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 20:23:41 +0000 Subject: [PATCH 5/7] Addressed comments --- .kokoro/build.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 66ba4a17849b..8c5632db939c 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -360,16 +360,24 @@ case ${JOB_TYPE} in esac -if [[ "${REPORT_COVERAGE}" == "true" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/codecov.sh" ]]; 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" && -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java +if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then + if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${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}" From 050d57b0d17a4e933bc1ead07d5c2b75b36380ca Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 20:34:41 +0000 Subject: [PATCH 6/7] Addressed comments --- .kokoro/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 8c5632db939c..469dba20c9d9 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -362,7 +362,7 @@ esac if [[ "${REPORT_COVERAGE}" == "true" ]]; then if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/codecov.sh" ]]; then - bash ${KOKORO_GFILE_DIR}/codecov.sh + bash "${KOKORO_GFILE_DIR}/codecov.sh" else echo "Warning: REPORT_COVERAGE is true, but codecov.sh was not found in KOKORO_GFILE_DIR." fi @@ -373,8 +373,8 @@ bash .kokoro/coerce_logs.sh if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java + chmod +x "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" + "${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 From 66e0ec55fa928b942db45aa048542d5633c47c0c Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 27 Oct 2026 20:45:44 +0000 Subject: [PATCH 7/7] Addressed comments --- .kokoro/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 469dba20c9d9..1badebcebd69 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -373,7 +373,7 @@ bash .kokoro/coerce_logs.sh if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then if [[ -n "${KOKORO_GFILE_DIR:-}" && -f "${KOKORO_GFILE_DIR:-}/linux_amd64/flakybot" ]]; then - chmod +x "${KOKORO_GFILE_DIR}/linux_amd64/flakybot" + 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."