Skip to content

Commit 23d5a8e

Browse files
authored
ci: skip heavy checks in Release Please SNAPSHOT pull requests (#11323)
1 parent 7224f19 commit 23d5a8e

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

.kokoro/build.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ case ${JOB_TYPE} in
5454
;;
5555
integration)
5656
generate_modified_modules_list
57-
if [[ ${#modified_module_list[@]} -gt 0 ]]; then
57+
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
58+
echo "Skipping integration tests as this is Release Please SNAPSHOT pull request."
59+
elif [[ ${#modified_module_list[@]} -gt 0 ]]; then
5860
module_list=$(
5961
IFS=,
6062
echo "${modified_module_list[*]}"
@@ -68,14 +70,20 @@ case ${JOB_TYPE} in
6870
;;
6971
graalvm-presubmit)
7072
generate_graalvm_presubmit_modules_list
71-
printf "Running GraalVM presubmit checks for:\n%s\n" "${module_list}"
72-
setup_cloud "$module_list"
73-
install_modules "$module_list"
74-
run_graalvm_tests "$module_list"
73+
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
74+
echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request."
75+
else
76+
printf "Running GraalVM presubmit checks for:\n%s\n" "${module_list}"
77+
setup_cloud "$module_list"
78+
install_modules "$module_list"
79+
run_graalvm_tests "$module_list"
80+
fi
7581
;;
7682
graalvm)
7783
generate_graalvm_modules_list
78-
if [ ! -z "${module_list}" ]; then
84+
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
85+
echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request."
86+
elif [ ! -z "${module_list}" ]; then
7987
printf "Running GraalVM checks for:\n%s\n" "${module_list}"
8088
setup_cloud "$module_list"
8189
install_modules "$module_list"

.kokoro/common.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,21 @@ function setup_cloud() {
140140
trap destroy EXIT
141141
}
142142

143+
# Prints "true" if this pull pull request is made by Release Please
144+
# SNAPSHOT pull request.
145+
# If a CI runs on a Release Please SNAPSHOT pull request, there's no point in running
146+
# integration tests because it only changes the versions in pom.xml and we merge
147+
# the pull requests without any additional changes (b/370011322).
148+
function release_please_snapshot_pull_request() {
149+
# Example value: "+google-cloud-java:1.48.0:1.49.0-SNAPSHOT"
150+
changedLine=$(git diff origin/main -- versions.txt 2>/dev/null | grep '^+google-cloud-java:')
151+
if [[ "$changedLine" =~ "SNAPSHOT"$ ]]; then
152+
echo "true"
153+
else
154+
echo "false"
155+
fi
156+
}
157+
143158
function generate_modified_modules_list() {
144159
# Find the files changed from when the PR branched to the last commit
145160
# Filter for java modules and get all the unique elements

0 commit comments

Comments
 (0)