From 2db03705265bc7bdf101690b352cbc66fa44cd9a Mon Sep 17 00:00:00 2001
From: Mridula <66699525+mpeddada1@users.noreply.github.com>
Date: Thu, 23 May 2024 21:33:58 -0400
Subject: [PATCH 1/4] chore: tag graalvm images with
infrastructure-public-image- (#2802)
Same as https://github.com/googleapis/java-shared-config/pull/829
---
.cloudbuild/graalvm/cloudbuild.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.cloudbuild/graalvm/cloudbuild.yaml b/.cloudbuild/graalvm/cloudbuild.yaml
index 2c458fdad8..1e3af76946 100644
--- a/.cloudbuild/graalvm/cloudbuild.yaml
+++ b/.cloudbuild/graalvm/cloudbuild.yaml
@@ -22,6 +22,7 @@ steps:
args: [
"build",
"-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:${_SHARED_DEPENDENCIES_VERSION}",
+ "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:infrastructure-public-image-$SHORT_SHA",
"--file", "graalvm_a.Dockerfile",
"--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION",
"."
@@ -35,6 +36,7 @@ steps:
args: [
"build",
"-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:${_SHARED_DEPENDENCIES_VERSION}",
+ "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:infrastructure-public-image-$SHORT_SHA",
"--file", "graalvm_b.Dockerfile",
"--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION",
"."
@@ -47,3 +49,5 @@ steps:
images:
- gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:${_SHARED_DEPENDENCIES_VERSION}
- gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:${_SHARED_DEPENDENCIES_VERSION}
+ - gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:infrastructure-public-image-$SHORT_SHA
+ - gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:infrastructure-public-image-$SHORT_SHA
\ No newline at end of file
From 9f3a6f2db80bc8a0689e9a22198b0b83b328eed4 Mon Sep 17 00:00:00 2001
From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
Date: Fri, 24 May 2024 11:47:18 -0400
Subject: [PATCH 2/4] chore: do not create pr description without qualified
commit (#2806)
In this PR:
- Do not generate `pr_description.txt` if no qualified commit found
between two googleapis commit.
---
library_generation/generate_pr_description.py | 9 +++++++
.../generate_pr_description_unit_tests.py | 25 +++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/library_generation/generate_pr_description.py b/library_generation/generate_pr_description.py
index a223a8f88d..92256c0a2f 100644
--- a/library_generation/generate_pr_description.py
+++ b/library_generation/generate_pr_description.py
@@ -22,6 +22,8 @@
from library_generation.utils.commit_message_formatter import format_commit_message
from library_generation.utils.commit_message_formatter import wrap_override_commit
+EMPTY_MESSAGE = ""
+
def generate_pr_descriptions(
config: GenerationConfig,
@@ -62,6 +64,10 @@ def generate_pr_descriptions(
is_monorepo=config.is_monorepo(),
)
+ if description == EMPTY_MESSAGE:
+ print("Empty commit messages, skip creating pull request description.")
+ return
+
description_file = f"{description_path}/pr_description.txt"
print(f"Writing pull request description to {description_file}")
with open(description_file, "w+") as f:
@@ -115,6 +121,9 @@ def get_commit_messages(
break
commit = commit_parents[0]
shutil.rmtree(tmp_dir, ignore_errors=True)
+ if len(qualified_commits) == 0:
+ return EMPTY_MESSAGE
+
return __combine_commit_messages(
current_commit=current_commit,
baseline_commit=baseline_commit,
diff --git a/library_generation/test/generate_pr_description_unit_tests.py b/library_generation/test/generate_pr_description_unit_tests.py
index 959c442805..3acc3f4e82 100644
--- a/library_generation/test/generate_pr_description_unit_tests.py
+++ b/library_generation/test/generate_pr_description_unit_tests.py
@@ -70,3 +70,28 @@ def test_generate_pr_description_with_same_googleapis_commits(self):
description_path=cwd,
)
self.assertFalse(os.path.isfile(f"{cwd}/pr_description.txt"))
+
+ def test_generate_pr_description_does_not_create_pr_description_without_qualified_commit(
+ self,
+ ):
+ # committed on May 22nd, 2024
+ old_commit_sha = "30717c0b0c9966906880703208a4c820411565c4"
+ # committed on May 23rd, 2024
+ new_commit_sha = "eeed69d446a90eb4a4a2d1762c49d637075390c1"
+ cwd = os.getcwd()
+ generate_pr_descriptions(
+ config=GenerationConfig(
+ gapic_generator_version="",
+ googleapis_commitish=new_commit_sha,
+ libraries_bom_version="",
+ template_excludes=[],
+ grpc_version="",
+ protoc_version="",
+ # use empty libraries to make sure no qualified commit between
+ # two commit sha.
+ libraries=[],
+ ),
+ baseline_commit=old_commit_sha,
+ description_path=cwd,
+ )
+ self.assertFalse(os.path.isfile(f"{cwd}/pr_description.txt"))
From 3ba43c3eedc049d217f19c4806eb5ee827d8af63 Mon Sep 17 00:00:00 2001
From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
Date: Fri, 24 May 2024 14:20:28 -0400
Subject: [PATCH 3/4] Revert "chore: add junit5 extension to setup environment
variable" (#2817)
Reverts googleapis/sdk-platform-java#2799 since `junit-pioneer` is not
compatible with Java 8.
---
.github/workflows/ci.yaml | 43 +++++++++++++++----
.github/workflows/sonar.yaml | 4 ++
gapic-generator-java-pom-parent/pom.xml | 17 ++++++++
gax-java/dependencies.properties | 1 -
gax-java/gax/BUILD.bazel | 1 -
gax-java/gax/pom.xml | 30 +++++++++----
.../api/gax/rpc/EndpointContextTest.java | 6 +--
gax-java/pom.xml | 6 ---
8 files changed, 81 insertions(+), 27 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 845a47eaac..01b2a3188c 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -22,6 +22,14 @@ jobs:
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage
+ # The `envVarTest` profile runs tests that require an environment variable
+ - name: Env Var Tests
+ run: |
+ mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
+ -Dfmt.skip -DenableTestCoverage -PenvVarTest
+ # Set the Env Var for this step only
+ env:
+ GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
- run: bazelisk version
- name: Install Maven modules
run: |
@@ -63,7 +71,15 @@ jobs:
- name: Unit Tests
run: |
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-
+ -Dfmt.skip -DenableTestCoverage
+ # The `envVarTest` profile runs tests that require an environment variable
+ - name: Env Var Tests
+ run: |
+ mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
+ -Dfmt.skip -DenableTestCoverage -PenvVarTest
+ # Set the Env Var for this step only
+ env:
+ GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
- run: bazelisk version
- name: Install Maven modules
run: |
@@ -95,14 +111,25 @@ jobs:
export PATH=${JAVA_HOME}/bin:$PATH
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
- mvn org.apache.maven.plugins:maven-surefire-plugin:test \
- verify \
- --batch-mode \
- --no-transfer-progress \
- -Dcheckstyle.skip \
+ mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip \
- -Djvm="${JAVA8_HOME}/bin/java" \
- -DargLine="-Djava.util.logging.SimpleFormatter.format='%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n'"
+ -Djvm="${JAVA8_HOME}/bin/java"
+ # The `envVarTest` profile runs tests that require an environment variable
+ - name: Compile with Java 17 and run tests with Java 8 (Env Var Tests)
+ shell: bash
+ run: |
+ set -x
+ export JAVA_HOME=$JAVA_HOME
+ export PATH=${JAVA_HOME}/bin:$PATH
+ # Maven surefire plugin lets us to specify the JVM when running tests via
+ # the "jvm" system property.
+ export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
+ mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
+ -Dfmt.skip -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
+ -PenvVarTest
+ # Set the Env Var for this step only
+ env:
+ GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
build-java8-gapic-generator-java:
name: "build(8) for gapic-generator-java"
diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml
index 6b5b70a257..585893942e 100644
--- a/.github/workflows/sonar.yaml
+++ b/.github/workflows/sonar.yaml
@@ -47,6 +47,10 @@ jobs:
tar -xf showcase-*
./gapic-showcase run &
cd -
+ # Intentionally do not run the Env Var Tests (no -PenvVarTests) as setting the Env Var
+ # may alter the results for other tests that use Env Var in the logic. Adding a Sonar
+ # step for a few tests (env var tests) may be overkill and should be better covered
+ # when we can upgrade to JUnit 5 (https://github.com/googleapis/sdk-platform-java/issues/1611#issuecomment-1970079325)
- name: Build and analyze for full test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml
index c9d4575f5d..9d0d87dace 100644
--- a/gapic-generator-java-pom-parent/pom.xml
+++ b/gapic-generator-java-pom-parent/pom.xml
@@ -182,6 +182,23 @@
+
+ envVarTest
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+
+ **/*.java
+
+
+
+
+
+
diff --git a/gax-java/dependencies.properties b/gax-java/dependencies.properties
index afa277876f..c2da1495d5 100644
--- a/gax-java/dependencies.properties
+++ b/gax-java/dependencies.properties
@@ -88,4 +88,3 @@ maven.net_bytebuddy_byte_buddy=net.bytebuddy:byte-buddy:1.14.16
maven.org_objenesis_objenesis=org.objenesis:objenesis:2.6
maven.org_junit_jupiter_junit_jupiter_api=org.junit.jupiter:junit-jupiter-api:5.10.2
maven.org_junit_jupiter_junit_jupiter_params=org.junit.jupiter:junit-jupiter-params:5.10.2
-maven.org_junit_pioneer_junit_pioneer=org.junit-pioneer:junit-pioneer:2.2.0
diff --git a/gax-java/gax/BUILD.bazel b/gax-java/gax/BUILD.bazel
index dae2f747f9..5dd3ff96bd 100644
--- a/gax-java/gax/BUILD.bazel
+++ b/gax-java/gax/BUILD.bazel
@@ -41,7 +41,6 @@ _TEST_COMPILE_DEPS = [
"@net_bytebuddy_byte_buddy//jar",
"@org_objenesis_objenesis//jar",
"@com_googlecode_java_diff_utils_diffutils//jar",
- "@org_junit_pioneer_junit_pioneer//jar",
]
java_library(
diff --git a/gax-java/gax/pom.xml b/gax-java/gax/pom.xml
index de5dda81d5..7f706b741a 100644
--- a/gax-java/gax/pom.xml
+++ b/gax-java/gax/pom.xml
@@ -99,18 +99,32 @@
+
org.apache.maven.plugins
maven-surefire-plugin
-
- -Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n"
-
- --add-opens java.base/java.util=ALL-UNNAMED
- --add-opens java.base/java.lang=ALL-UNNAMED
-
+ -Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n"
+
+ !EndpointContextTest#endpointContextBuild_universeDomainEnvVarSet+endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority
-
+
+
+
+ envVarTest
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ EndpointContextTest#endpointContextBuild_universeDomainEnvVarSet+endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java b/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java
index ab298e039d..98a32bc05a 100644
--- a/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java
+++ b/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java
@@ -40,7 +40,6 @@
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.SetEnvironmentVariable;
import org.mockito.Mockito;
class EndpointContextTest {
@@ -338,8 +337,8 @@ void endpointContextBuild_gdchFlow_noUniverseDomain_customEndpoint() throws IOEx
// This Universe Domain should match the `GOOGLE_CLOUD_UNIVERSE_DOMAIN` Env Var
// For this test running locally or in CI, check that the Env Var is set properly.
+ // This test should only run when the maven profile `EnvVarTest` is enabled.
@Test
- @SetEnvironmentVariable(key = EndpointContext.GOOGLE_CLOUD_UNIVERSE_DOMAIN, value = "random.com")
void endpointContextBuild_universeDomainEnvVarSet() throws IOException {
String envVarUniverseDomain = "random.com";
EndpointContext endpointContext =
@@ -353,10 +352,11 @@ void endpointContextBuild_universeDomainEnvVarSet() throws IOException {
// This Universe Domain should match the `GOOGLE_CLOUD_UNIVERSE_DOMAIN` Env Var
// For this test running locally or in CI, check that the Env Var is set properly.
+ // This test should only run when the maven profile `EnvVarTest` is enabled.
@Test
- @SetEnvironmentVariable(key = EndpointContext.GOOGLE_CLOUD_UNIVERSE_DOMAIN, value = "random.com")
void endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority()
throws IOException {
+ // This test has `GOOGLE_CLOUD_UNIVERSE_DOMAIN` = `random.com`
String clientSettingsUniverseDomain = "clientSettingsUniverseDomain.com";
EndpointContext endpointContext =
defaultEndpointContextBuilder
diff --git a/gax-java/pom.xml b/gax-java/pom.xml
index 8737de90a3..9adaacbbff 100644
--- a/gax-java/pom.xml
+++ b/gax-java/pom.xml
@@ -205,12 +205,6 @@
test
-
- org.junit-pioneer
- junit-pioneer
- 2.2.0
- test
-
From 29abcfd62499deddacfcfb0465b2cd9220f4929c Mon Sep 17 00:00:00 2001
From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
Date: Fri, 24 May 2024 15:52:09 -0400
Subject: [PATCH 4/4] chore: setup release-please to update generator version
in generation configuration (#2819)
In this PR:
- Setup release-please to update the generator version in the
`generation_config.yaml`.
---
.github/release-please.yml | 2 +-
generation_config.yaml | 2 +-
release-please-config.json | 9 ++++++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/.github/release-please.yml b/.github/release-please.yml
index c335a3f0aa..a2e978d935 100644
--- a/.github/release-please.yml
+++ b/.github/release-please.yml
@@ -3,4 +3,4 @@ bumpMinorPreMajor: true
handleGHRelease: true
primaryBranch: main
manifest: true
-extraFiles: ["WORKSPACE", ".cloudbuild/graalvm/cloudbuild.yaml", ".cloudbuild/graalvm/cloudbuild-test-a.yaml", ".cloudbuild/graalvm/cloudbuild-test-b.yaml", ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml" ]
+extraFiles: ["WORKSPACE", ".cloudbuild/graalvm/cloudbuild.yaml", ".cloudbuild/graalvm/cloudbuild-test-a.yaml", ".cloudbuild/graalvm/cloudbuild-test-b.yaml", ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml", "generation_config.yaml"]
diff --git a/generation_config.yaml b/generation_config.yaml
index 042b5e4f38..9c3ca80e0e 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,4 +1,4 @@
-gapic_generator_version: 2.40.2-SNAPSHOT
+gapic_generator_version: 2.40.2-SNAPSHOT # {x-version-update:gapic-generator-java:current}
googleapis_commitish: 3d50414a7ff3f0b8ffe8ad7858257396e4f18131
template_excludes:
- .github/*
diff --git a/release-please-config.json b/release-please-config.json
index ddf1373290..911f86b3ee 100644
--- a/release-please-config.json
+++ b/release-please-config.json
@@ -5,7 +5,14 @@
"group-pull-request-title-pattern": "chore(${branch}): release ${version}",
"packages": {
".": {
- "extra-files": ["WORKSPACE", ".cloudbuild/graalvm/cloudbuild.yaml", ".cloudbuild/graalvm/cloudbuild-test-a.yaml", ".cloudbuild/graalvm/cloudbuild-test-b.yaml", ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml"]
+ "extra-files": [
+ "WORKSPACE",
+ ".cloudbuild/graalvm/cloudbuild.yaml",
+ ".cloudbuild/graalvm/cloudbuild-test-a.yaml",
+ ".cloudbuild/graalvm/cloudbuild-test-b.yaml",
+ ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml",
+ "generation_config.yaml"
+ ]
}
}
}
\ No newline at end of file