From ace8c530c6397767a7e76752bfc5dc73ff98650c Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 29 Aug 2022 20:47:52 +0000 Subject: [PATCH 1/8] fix: Update java-vision IT Test Case Results --- .../test/java/com/google/cloud/vision/it/ITSystemTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java index 9ba1ee4047e1..b6e29c6ac145 100644 --- a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java +++ b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java @@ -492,7 +492,7 @@ public void detectWebEntitiesGcsTest() throws IOException { actual.add(entity.getDescription()); } } - assertThat(actual).contains("The Palace Of Fine Arts"); + assertThat(actual).contains("Palace Of Fine Arts"); } @Test @@ -554,7 +554,7 @@ public void detectWebEntitiesIncludeGeoResultsGcsTest() { actual.add(entity.getDescription()); } } - assertThat(actual).contains("The Palace Of Fine Arts"); + assertThat(actual).contains("Palace Of Fine Arts"); } @Test @@ -727,4 +727,4 @@ public void getReferenceImageTest() { assertEquals(referenceImage.getName(), actualReferenceImage.getName()); assertEquals(referenceImage.getUri(), actualReferenceImage.getUri()); } -} +} \ No newline at end of file From 43fcd768bed605dc995580581102c11d9940bdaf Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 30 Aug 2022 14:36:49 +0000 Subject: [PATCH 2/8] fix: Update invalid IT test cases results --- .../java/com/google/cloud/vision/it/ITSystemTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java index b6e29c6ac145..17a86b8563cb 100644 --- a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java +++ b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java @@ -473,7 +473,7 @@ public void detectSafeSearchGcsTest() throws IOException { } @Test - public void detectWebEntitiesGcsTest() throws IOException { + public void detectWebEntitiesGcsTest() { ImageSource imgSource = ImageSource.newBuilder().setGcsImageUri(SAMPLE_BUCKET + "landmark/pofa.jpg").build(); Image img = Image.newBuilder().setSource(imgSource).build(); @@ -492,7 +492,7 @@ public void detectWebEntitiesGcsTest() throws IOException { actual.add(entity.getDescription()); } } - assertThat(actual).contains("Palace Of Fine Arts"); + assertThat(actual).contains("Palace of Fine Arts"); } @Test @@ -547,14 +547,12 @@ public void detectWebEntitiesIncludeGeoResultsGcsTest() { imageAnnotatorClient.batchAnnotateImages(ImmutableList.of(request)); List responses = response.getResponsesList(); List actual = new ArrayList<>(); - System.out.println("WebEntitiesGeo SIZE"); - System.out.println(actual.size()); for (AnnotateImageResponse imgResponse : responses) { for (WebDetection.WebEntity entity : imgResponse.getWebDetection().getWebEntitiesList()) { actual.add(entity.getDescription()); } } - assertThat(actual).contains("Palace Of Fine Arts"); + assertThat(actual).contains("Palace of Fine Arts"); } @Test From 6f2cd68b8c718347346dc8e578eed779ee75eed7 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 30 Aug 2022 14:41:54 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- java-vision/README.md | 6 +++--- .../test/java/com/google/cloud/vision/it/ITSystemTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java-vision/README.md b/java-vision/README.md index 35199363b5ee..a18aa250db9f 100644 --- a/java-vision/README.md +++ b/java-vision/README.md @@ -50,20 +50,20 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.0.0') +implementation platform('com.google.cloud:libraries-bom:26.1.0') implementation 'com.google.cloud:google-cloud-vision' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-vision:3.0.1' +implementation 'com.google.cloud:google-cloud-vision:3.1.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.0.1" +libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.1.0" ``` ## Authentication diff --git a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java index 17a86b8563cb..517fc799a122 100644 --- a/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java +++ b/java-vision/google-cloud-vision/src/test/java/com/google/cloud/vision/it/ITSystemTest.java @@ -725,4 +725,4 @@ public void getReferenceImageTest() { assertEquals(referenceImage.getName(), actualReferenceImage.getName()); assertEquals(referenceImage.getUri(), actualReferenceImage.getUri()); } -} \ No newline at end of file +} From 9bb85f932b989c633ddb03bc5b9b1e351d967658 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 30 Aug 2022 16:31:29 +0000 Subject: [PATCH 4/8] fix: check TEST_ALL var for truthy value --- .kokoro/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 9a619b87ffcd..d45a2f0019f9 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -112,7 +112,7 @@ case ${JOB_TYPE} in printf "Module List:\n%s\n" "${module_list}" fi - if [ ${TEST_ALL} ]; then + if [ "${TEST_ALL}" = true ]; then mvn -B ${INTEGRATION_TEST_ARGS} \ -ntp \ -Penable-integration-tests \ From 89738c1bc72f40feb512e083e25725c0c5838db0 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 30 Aug 2022 19:22:56 +0000 Subject: [PATCH 5/8] chore: Cleanup kokoro build file --- .kokoro/build.sh | 116 ++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 67 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index d45a2f0019f9..9dd723676aa7 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -27,6 +27,38 @@ source ${scriptDir}/common.sh mkdir -p ${HOME}/.m2 cp settings.xml ${HOME}/.m2 +excluded_modules=('CoverageAggregator' 'google-cloud-gapic-bom') + +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 + # grep returns 1 (error code) and exits the pipeline if there is no match + # If there is no match, it will return true so the rest of the commands can run + modified_files=$(git diff --name-only $KOKORO_GITHUB_PULL_REQUEST_COMMIT $KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH) + printf "Modified files:\n%s\n" "${modified_files}" + + # If root pom.xml is touched, run ITs on all the modules + root_pom_modified=$(echo "${modified_files}" | grep -e '^pom.xml$' || true) + if [[ -n $root_pom_modified ]]; then + module_list=$excluded_modules_string + echo "Testing the entire monorepo" + else + directories=$(echo "${modified_files}" | grep -e 'java-.*' || true) + printf "Files in java modules:\n%s\n" "${directories}" + if [[ -n $directories ]]; then + directories=$(echo "${directories}" | cut -d '/' -f1 | sort -u) + for directory in $directories + do + dir_list+=($directory) + done + # Combine each entry with a comma + module_list=$(IFS=, ; echo "${dir_list[*]}") + module_list="${module_list},${excluded_modules_string}" + printf "Module List:\n%s\n" "${module_list}" + fi + fi +} + function assign_modules_to_job() { modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g') module_list=() @@ -41,11 +73,21 @@ function assign_modules_to_job() { num=$((num + 1)) done module_list=$(IFS=, ; echo "${module_list[*]}") + module_list="${module_list},${excluded_modules_string}" } -excluded_modules=('CoverageAggregator' 'google-cloud-gapic-bom') +function generate_excluded_module_string() { + excluded_modules_list=() + for excluded_module in "${excluded_modules[@]}" + do + excluded_modules_list+=("!${excluded_module}") + done + excluded_modules_string=$(IFS=, ; echo "${excluded_modules_list[*]}") +} -mvn -B -pl "!google-cloud-gapic-bom,!CoverageAggregator" \ +generate_excluded_module_string + +mvn -B -pl ${excluded_modules_string} \ -ntp \ -DtrimStackTrace=false \ -Dclirr.skip=true \ @@ -70,68 +112,12 @@ fi RETURN_CODE=0 case ${JOB_TYPE} in - test) - mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; - lint) - mvn com.coveo:fmt-maven-plugin:check -B -ntp - RETURN_CODE=$? - ;; - javadoc) - mvn javadoc:javadoc javadoc:test-javadoc -B -ntp - RETURN_CODE=$? - ;; integration) - TEST_ALL=false - # Find the files changed from when the PR branched to the last commit - # Filter for java modules and get all the unique elements - # grep returns 1 (error code) and exits the pipeline if there is no match - # If there is no match, it will return true so the rest of the commands can run - modified_files=$(git diff --name-only $KOKORO_GITHUB_PULL_REQUEST_COMMIT $KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH) - printf "Modified files:\n%s\n" "${modified_files}" - - # If root pom.xml is touched, run ITs on all the modules - root_pom_modified=$(echo "${modified_files}" | grep -e '^pom.xml$' || true) - if [[ -n $root_pom_modified ]]; then - TEST_ALL=true - echo "Testing the entire monorepo" - else - directories=$(echo "${modified_files}" | grep -e 'java-.*' || true) - printf "Files in java modules:\n%s\n" "${directories}" - if [[ -n $directories ]]; then - directories=$(echo "${directories}" | cut -d '/' -f1 | sort -u) - dir_list=() - for directory in $directories - do - dir_list+=($directory) - done - # Combine each entry with a comma - module_list=$(IFS=, ; echo "${dir_list[*]}") - fi - printf "Module List:\n%s\n" "${module_list}" - fi - - if [ "${TEST_ALL}" = true ]; then - mvn -B ${INTEGRATION_TEST_ARGS} \ - -ntp \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dcheckstyle.skip=true \ - -Dflatten.skip=true \ - -Danimal.sniffer.skip=true \ - -Djacoco.skip=true \ - -DskipUnitTests=true \ - -fae \ - -T 1C \ - verify - RETURN_CODE=$? - elif [[ -n $module_list ]]; then + generate_modified_modules_list + if [[ -n $module_list ]]; then printf "Running Integration Tests for:\n%s\n" "${module_list}" mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl "${module_list}" \ + -pl ${module_list} \ -amd \ -ntp \ -Penable-integration-tests \ @@ -159,7 +145,7 @@ case ${JOB_TYPE} in # Run Unit and Integration Tests with Native Image if [[ -n $module_list ]]; then mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl "${module_list}" \ + -pl ${module_list} \ -amd \ -ntp \ -DtrimStackTrace=false \ @@ -185,7 +171,7 @@ case ${JOB_TYPE} in # Run Unit and Integration Tests with Native Image if [[ -n $module_list ]]; then mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl "${module_list}" \ + -pl ${module_list} \ -amd \ -ntp \ -DtrimStackTrace=false \ @@ -232,10 +218,6 @@ case ${JOB_TYPE} in echo "no sample pom.xml found - skipping sample tests" fi ;; - clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; *) ;; esac From 713e66a24ab7e12b56529cc21dd7b2ebcdf0beb0 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 30 Aug 2022 21:02:21 +0000 Subject: [PATCH 6/8] fix: Use different string from module_list --- .kokoro/build.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 9dd723676aa7..f0e8faa2bfb2 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -61,18 +61,18 @@ function generate_modified_modules_list() { function assign_modules_to_job() { modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g') - module_list=() + maven_module_list=() num=0 for module in $modules do # Add 1 as JOB_NUMBER is 1-indexed instead of 0-indexed mod_num=$((num % NUM_JOBS + 1)) if [[ ! "${excluded_modules[*]}" =~ $module ]] && [[ $mod_num -eq $JOB_NUMBER ]]; then - module_list+=($module) + maven_module_list+=($module) fi num=$((num + 1)) done - module_list=$(IFS=, ; echo "${module_list[*]}") + module_list=$(IFS=, ; echo "${maven_module_list[*]}") module_list="${module_list},${excluded_modules_string}" } @@ -85,6 +85,7 @@ function generate_excluded_module_string() { excluded_modules_string=$(IFS=, ; echo "${excluded_modules_list[*]}") } +# Generate excluded_modules_string generate_excluded_module_string mvn -B -pl ${excluded_modules_string} \ From 1463e3c9b3d5b10c38c138d9d54741a4b5f0d745 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Wed, 31 Aug 2022 02:48:49 +0000 Subject: [PATCH 7/8] chore: Don't exclude when building --- .kokoro/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index f0e8faa2bfb2..411974448818 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -88,7 +88,7 @@ function generate_excluded_module_string() { # Generate excluded_modules_string generate_excluded_module_string -mvn -B -pl ${excluded_modules_string} \ +mvn -B \ -ntp \ -DtrimStackTrace=false \ -Dclirr.skip=true \ From 1832180716ae94b529b3ef9cd43d3dacb7cd58f8 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Wed, 31 Aug 2022 03:55:24 +0000 Subject: [PATCH 8/8] chore: Only exclude module when building --- .kokoro/build.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 411974448818..869cd99014a0 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -53,7 +53,6 @@ function generate_modified_modules_list() { done # Combine each entry with a comma module_list=$(IFS=, ; echo "${dir_list[*]}") - module_list="${module_list},${excluded_modules_string}" printf "Module List:\n%s\n" "${module_list}" fi fi @@ -73,7 +72,6 @@ function assign_modules_to_job() { num=$((num + 1)) done module_list=$(IFS=, ; echo "${maven_module_list[*]}") - module_list="${module_list},${excluded_modules_string}" } function generate_excluded_module_string() { @@ -88,7 +86,7 @@ function generate_excluded_module_string() { # Generate excluded_modules_string generate_excluded_module_string -mvn -B \ +mvn -B -pl "${excluded_modules_string}" \ -ntp \ -DtrimStackTrace=false \ -Dclirr.skip=true \ @@ -118,7 +116,7 @@ case ${JOB_TYPE} in if [[ -n $module_list ]]; then printf "Running Integration Tests for:\n%s\n" "${module_list}" mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl ${module_list} \ + -pl "${module_list}" \ -amd \ -ntp \ -Penable-integration-tests \ @@ -146,7 +144,7 @@ case ${JOB_TYPE} in # Run Unit and Integration Tests with Native Image if [[ -n $module_list ]]; then mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl ${module_list} \ + -pl "${module_list}" \ -amd \ -ntp \ -DtrimStackTrace=false \ @@ -172,7 +170,7 @@ case ${JOB_TYPE} in # Run Unit and Integration Tests with Native Image if [[ -n $module_list ]]; then mvn -B ${INTEGRATION_TEST_ARGS} \ - -pl ${module_list} \ + -pl "${module_list}" \ -amd \ -ntp \ -DtrimStackTrace=false \