Skip to content

Commit

Permalink
ci: skip heavy checks in Release Please SNAPSHOT pull requests (googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
suztomo authored Nov 21, 2024
1 parent 7224f19 commit 23d5a8e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[*]}"
Expand All @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23d5a8e

Please sign in to comment.