diff --git a/.kokoro/build.sh b/.kokoro/build.sh index f93227e80b8d..2e2efd05017c 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -54,7 +54,9 @@ case ${JOB_TYPE} in ;; integration) generate_modified_modules_list - if [[ ${#modified_module_list[@]} -gt 0 ]]; then + if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then + echo "Skipping integration tests as this is Release Please SNAPSHOT pull request." + elif [[ ${#modified_module_list[@]} -gt 0 ]]; then module_list=$( IFS=, echo "${modified_module_list[*]}" @@ -68,14 +70,20 @@ case ${JOB_TYPE} in ;; graalvm-presubmit) generate_graalvm_presubmit_modules_list - printf "Running GraalVM presubmit checks for:\n%s\n" "${module_list}" - setup_cloud "$module_list" - install_modules "$module_list" - run_graalvm_tests "$module_list" + if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then + echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request." + else + printf "Running GraalVM presubmit checks for:\n%s\n" "${module_list}" + setup_cloud "$module_list" + install_modules "$module_list" + run_graalvm_tests "$module_list" + fi ;; graalvm) generate_graalvm_modules_list - if [ ! -z "${module_list}" ]; then + if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then + echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request." + elif [ ! -z "${module_list}" ]; then printf "Running GraalVM checks for:\n%s\n" "${module_list}" setup_cloud "$module_list" install_modules "$module_list" diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 9823eb423500..b7a0f0e811e9 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -140,6 +140,21 @@ function setup_cloud() { trap destroy EXIT } +# Prints "true" if this pull pull request is made by Release Please +# SNAPSHOT pull request. +# If a CI runs on a Release Please SNAPSHOT pull request, there's no point in running +# integration tests because it only changes the versions in pom.xml and we merge +# the pull requests without any additional changes (b/370011322). +function release_please_snapshot_pull_request() { + # Example value: "+google-cloud-java:1.48.0:1.49.0-SNAPSHOT" + changedLine=$(git diff origin/main -- versions.txt 2>/dev/null | grep '^+google-cloud-java:') + if [[ "$changedLine" =~ "SNAPSHOT"$ ]]; then + echo "true" + else + echo "false" + fi +} + function generate_modified_modules_list() { # Find the files changed from when the PR branched to the last commit # Filter for java modules and get all the unique elements