From f0831036c0427ebaeceef9354a17f462cf040559 Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 10 Jun 2021 13:27:09 -0700 Subject: [PATCH 1/8] =?UTF-8?q?fix(bazel):=20Remove=20monolith=20rule=20de?= =?UTF-8?q?ps=20from=20the=20Java=20=C2=B5gen=20Bazel=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WORKSPACE | 20 ++++++++++++++++++-- rules_java_gapic/java_gapic.bzl | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index f5101f83fc..bce7a60448 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,8 +18,14 @@ http_archive( jvm_maven_import_external( name = "google_java_format_all_deps", artifact = "com.google.googlejavaformat:google-java-format:jar:all-deps:1.7", - server_urls = ["https://repo.maven.apache.org/maven2/", "http://repo1.maven.org/maven2/"], - licenses = ["notice", "reciprocal"] + licenses = [ + "notice", + "reciprocal", + ], + server_urls = [ + "https://repo.maven.apache.org/maven2/", + "http://repo1.maven.org/maven2/", + ], ) # gax-java and its transitive dependencies must be imported before @@ -62,8 +68,18 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() +# Bazel rules. +_rules_gapic_version = "0.5.4" + +http_archive( + name = "rules_gapic", + strip_prefix = "rules_gapic-%s" % _rules_gapic_version, + urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version], +) + # Java dependencies. # Import the monolith so we can transitively use its gapic rules for googleapis. +# TODO: Remove this after this dep has been removed from googleapis' switched_rules_by_language. http_archive( name = "com_google_api_codegen", strip_prefix = "gapic-generator-2.11.1", diff --git a/rules_java_gapic/java_gapic.bzl b/rules_java_gapic/java_gapic.bzl index 505fbfdbc3..dbc7e4c5b7 100644 --- a/rules_java_gapic/java_gapic.bzl +++ b/rules_java_gapic/java_gapic.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@com_google_api_codegen//rules_gapic:gapic.bzl", "proto_custom_library", "unzipped_srcjar") +load("@rules_gapic//:gapic.bzl", "proto_custom_library", "unzipped_srcjar") SERVICE_YAML_ALLOWLIST = ["clouddms", "cloudkms", "datastream", "pubsub"] NO_GRPC_CONFIG_ALLOWLIST = ["library"] From 4d2a750374b4ecdbb2999417c5cee31e04b64521 Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Tue, 15 Jun 2021 15:06:55 -0700 Subject: [PATCH 2/8] fix: update library rules, add bazel clean to CI --- .github/workflows/ci.yaml | 4 +- test/integration/BUILD.bazel | 178 ++++++++++++++++-- .../v1/stub/LibraryServiceStubSettings.java | 77 +++----- 3 files changed, 192 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1b5b979aaf..548e2feb0c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,9 @@ jobs: run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress --test_output=errors - name: Integration Tests - run: bazel --batch test //test/integration:asset //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress + run: | + bazel clean --expunge --async + bazel --batch test //test/integration:asset //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress - uses: actions/upload-artifact@v2 if: ${{ failure() }} diff --git a/test/integration/BUILD.bazel b/test/integration/BUILD.bazel index db8a0bf839..45dd3e5ea2 100644 --- a/test/integration/BUILD.bazel +++ b/test/integration/BUILD.bazel @@ -1,12 +1,14 @@ load( - "@com_google_googleapis_imports//:imports.bzl", - "java_gapic_assembly_gradle_pkg", + "@gapic_generator_java//rules_java_gapic:java_gapic.bzl", "java_gapic_library", "java_gapic_test", - "java_grpc_library", - "java_proto_library", - "proto_library_with_info", ) +load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library") +load( + "@gapic_generator_java//rules_java_gapic:java_gapic_pkg.bzl", + "java_gapic_assembly_gradle_pkg", +) +load("@rules_gapic//:gapic.bzl", "proto_library_with_info") load( "//:rules_bazel/java/integration_test.bzl", "golden_update", @@ -29,20 +31,20 @@ INTEGRATION_TEST_LIBRARIES = [ "logging", # Java package remapping in gapic.yaml. "redis", # Has a gapic.yaml. "library", # No gRPC service config. - "compute", # REGAPIC test. + "compute", # REGAPIC test. ] # Keys must match the values in INTEGRATION_TEST_LIBRARIES above. API_GAPIC_TARGETS = { - "asset": "@com_google_googleapis//google/cloud/asset/v1:asset_java_gapic", - "credentials": "@com_google_googleapis//google/iam/credentials/v1:credentials_java_gapic", + "asset": ":asset_java_gapic", + "credentials": ":credentials_java_gapic", "iam": ":iam_java_gapic", # Googleapis' LRO does not have a Java Gapic. "kms": ":kms_java_gapic", # Local target because mixins are not rolled out yet. "pubsub": ":pubsub_java_gapic", - "logging": "@com_google_googleapis//google/logging/v2:logging_java_gapic", - "redis": "@com_google_googleapis//google/cloud/redis/v1beta1:redis_java_gapic", - "library": "@com_google_googleapis//google/example/library/v1:library_java_gapic", - "compute": "@com_google_googleapis_discovery//google/cloud/compute/v1:compute_small_java_gapic", + "logging": ":logging_java_gapic", + "redis": ":redis_java_gapic", + "library": ":library_java_gapic", + "compute": ":compute_small_java_gapic", } [integration_test( @@ -57,6 +59,154 @@ API_GAPIC_TARGETS = { target = API_GAPIC_TARGETS[lib_name], ) for lib_name in INTEGRATION_TEST_LIBRARIES] +################################################### +# Temporary proto_with_info definitions for +# monolith depdency removal. +# Remove this section when the monolith rule deps are +# out of googleapis. +################################################### +proto_library_with_info( + name = "asset_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/cloud/asset/v1:asset_proto", + ], +) + +proto_library_with_info( + name = "credentials_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/iam/credentials/v1:credentials_proto", + ], +) + +proto_library_with_info( + name = "logging_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/logging/v2:logging_proto", + ], +) + +proto_library_with_info( + name = "pubsub_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/iam/v1:iam_policy_proto", + "@com_google_googleapis//google/iam/v1:policy_proto", + "@com_google_googleapis//google/pubsub/v1:pubsub_proto", + ], +) + +proto_library_with_info( + name = "redis_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/cloud/redis/v1beta1:redis_proto", + ], +) + +proto_library_with_info( + name = "iam_proto_with_info", + deps = [ + "@com_google_googleapis//google/iam/v1:iam_policy_proto", + "@com_google_googleapis//google/iam/v1:options_proto", + "@com_google_googleapis//google/iam/v1:policy_proto", + ], +) + +proto_library_with_info( + name = "library_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis//google/example/library/v1:library_proto", + ], +) + +proto_library_with_info( + name = "compute_small_proto_with_info", + deps = [ + "@com_google_googleapis//google/cloud:common_resources_proto", + "@com_google_googleapis_discovery//google/cloud/compute/v1:compute_small_proto", + ], +) + +java_gapic_library( + name = "compute_small_java_gapic", + srcs = [":compute_small_proto_with_info"], + test_deps = [], + transport = "rest", + deps = [ + "@com_google_googleapis_discovery//google/cloud/compute/v1:compute_small_java_proto", + ], +) + +java_gapic_library( + name = "asset_java_gapic", + srcs = [":asset_proto_with_info"], + grpc_service_config = "@com_google_googleapis//google/cloud/asset/v1:cloudasset_grpc_service_config.json", + test_deps = [ + "@com_google_googleapis//google/cloud/asset/v1:asset_java_grpc", + "@com_google_googleapis//google/iam/v1:iam_java_grpc", + ], + deps = [ + "@com_google_googleapis//google/cloud/asset/v1:asset_java_proto", + "@com_google_googleapis//google/iam/v1:iam_java_proto", + "@com_google_googleapis//google/identity/accesscontextmanager/v1:accesscontextmanager_proto", + ], +) + +java_gapic_library( + name = "credentials_java_gapic", + srcs = [":credentials_proto_with_info"], + grpc_service_config = "@com_google_googleapis//google/iam/credentials/v1:iamcredentials_grpc_service_config.json", + test_deps = [ + "@com_google_googleapis//google/iam/credentials/v1:credentials_java_grpc", + ], + deps = [ + "@com_google_googleapis//google/iam/credentials/v1:credentials_java_proto", + ], +) + +java_gapic_library( + name = "logging_java_gapic", + srcs = [":logging_proto_with_info"], + gapic_yaml = "@com_google_googleapis//google/logging/v2:logging_gapic.yaml", + grpc_service_config = "@com_google_googleapis//google/logging/v2:logging_grpc_service_config.json", + test_deps = [ + "@com_google_googleapis//google/logging/v2:logging_java_grpc", + ], + deps = [ + "@com_google_googleapis//google/api:api_java_proto", + "@com_google_googleapis//google/logging/v2:logging_java_proto", + ], +) + +java_gapic_library( + name = "redis_java_gapic", + srcs = [":redis_proto_with_info"], + gapic_yaml = "@com_google_googleapis//google/cloud/redis/v1beta1:redis_gapic.yaml", + grpc_service_config = "@com_google_googleapis//google/cloud/redis/v1beta1:redis_grpc_service_config.json", + test_deps = [ + "@com_google_googleapis//google/cloud/redis/v1beta1:redis_java_grpc", + ], + deps = [ + "@com_google_googleapis//google/cloud/redis/v1beta1:redis_java_proto", + ], +) + +java_gapic_library( + name = "library_java_gapic", + srcs = [":library_proto_with_info"], + gapic_yaml = "@com_google_googleapis//google/example/library/v1:library_example_gapic.yaml", + test_deps = [ + "@com_google_googleapis//google/example/library/v1:library_java_grpc", + ], + deps = [ + "@com_google_googleapis//google/example/library/v1:library_java_proto", + ], +) #################################################### # API Library Rules #################################################### @@ -168,7 +318,7 @@ java_gapic_assembly_gradle_pkg( # IAM (for a standalone mixed-in API). java_gapic_library( name = "iam_java_gapic", - srcs = ["@com_google_googleapis//google/iam/v1:iam_proto_with_info"], + srcs = [":iam_proto_with_info"], grpc_service_config = "iam_grpc_service_config.json", test_deps = [ "@com_google_googleapis//google/iam/v1:iam_java_grpc", @@ -283,7 +433,7 @@ java_gapic_assembly_gradle_pkg( # TODO: Remove some of these targets when PubSub has been migrated in googleapis. java_gapic_library( name = "pubsub_java_gapic", - srcs = ["@com_google_googleapis//google/pubsub/v1:pubsub_proto_with_info"], + srcs = [":pubsub_proto_with_info"], gapic_yaml = "@com_google_googleapis//google/pubsub/v1:pubsub_gapic.yaml", grpc_service_config = "@com_google_googleapis//google/pubsub/v1:pubsub_grpc_service_config.json", # For the IAM mixin. diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java index bb98270faa..056516530c 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java @@ -64,7 +64,6 @@ import java.io.IOException; import java.util.List; import javax.annotation.Generated; -import org.threeten.bp.Duration; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** @@ -393,13 +392,7 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); - definitions.put( - "retry_policy_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_0_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -408,28 +401,8 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(60000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(60000L)) - .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(60000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(60000L)) - .build(); - definitions.put("retry_policy_0_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -514,58 +487,58 @@ private static Builder createDefault() { private static Builder initDefaults(Builder builder) { builder .createShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .getShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .listShelvesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .deleteShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .mergeShelvesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .createBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .getBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .listBooksSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .deleteBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .updateBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .moveBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); return builder; } From d120d92b79af392ab0c49c6161089174433b8c6f Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Tue, 15 Jun 2021 15:57:48 -0700 Subject: [PATCH 3/8] fix: remove Bazel clean from CI --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 548e2feb0c..9988dfcdaa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,7 +50,6 @@ jobs: - name: Integration Tests run: | - bazel clean --expunge --async bazel --batch test //test/integration:asset //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress - uses: actions/upload-artifact@v2 From 299d2ce7f632da0696ebfe510511deefdfb6e844 Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 17 Jun 2021 11:18:18 -0700 Subject: [PATCH 4/8] fix: add compute --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9988dfcdaa..a879dfccdb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,7 +50,7 @@ jobs: - name: Integration Tests run: | - bazel --batch test //test/integration:asset //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress + bazel --batch test //test/integration:asset //test/integration:compute //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress - uses: actions/upload-artifact@v2 if: ${{ failure() }} From f2db018b406fb9eac24ed7263abe4f6c4c517210 Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 17 Jun 2021 11:24:48 -0700 Subject: [PATCH 5/8] fix: update library goldens --- test/integration/BUILD.bazel | 1 + .../v1/stub/LibraryServiceStubSettings.java | 77 +++++++++++++------ 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/test/integration/BUILD.bazel b/test/integration/BUILD.bazel index 45dd3e5ea2..93b90f2041 100644 --- a/test/integration/BUILD.bazel +++ b/test/integration/BUILD.bazel @@ -200,6 +200,7 @@ java_gapic_library( name = "library_java_gapic", srcs = [":library_proto_with_info"], gapic_yaml = "@com_google_googleapis//google/example/library/v1:library_example_gapic.yaml", + grpc_service_config = "@com_google_googleapis//google/example/library/v1:library_grpc_service_config.json", test_deps = [ "@com_google_googleapis//google/example/library/v1:library_java_grpc", ], diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java index 056516530c..bb98270faa 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java @@ -64,6 +64,7 @@ import java.io.IOException; import java.util.List; import javax.annotation.Generated; +import org.threeten.bp.Duration; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** @@ -392,7 +393,13 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -401,8 +408,28 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_1_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -487,58 +514,58 @@ private static Builder createDefault() { private static Builder initDefaults(Builder builder) { builder .createShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .getShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listShelvesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteShelfSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .mergeShelvesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .createBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .getBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listBooksSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .moveBookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); return builder; } From b0a3e61f7c01a419a60ae0aac124e43e5925614c Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 17 Jun 2021 11:47:43 -0700 Subject: [PATCH 6/8] fix: simplify integration test targets in CI --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a879dfccdb..dbf5754794 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,8 +49,7 @@ jobs: run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress --test_output=errors - name: Integration Tests - run: | - bazel --batch test //test/integration:asset //test/integration:compute //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress + run: bazel --batch test //test/integration/... - uses: actions/upload-artifact@v2 if: ${{ failure() }} From 238561592d194a021f6d6695a10314321169758a Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 17 Jun 2021 12:55:56 -0700 Subject: [PATCH 7/8] fix: CI build --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbf5754794..a1977c65e8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,6 +49,11 @@ jobs: run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress --test_output=errors - name: Integration Tests + run: bazel --batch test //test/integration:asset //test/integration:compute //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + run: bazel --batch test //test/integration/... - uses: actions/upload-artifact@v2 From bd3bb426462ae96f5c51cd042b55e727b1ad8669 Mon Sep 17 00:00:00 2001 From: Mira Leung Date: Thu, 17 Jun 2021 12:56:34 -0700 Subject: [PATCH 8/8] fix: CI build --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a1977c65e8..255466834a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,6 +49,7 @@ jobs: run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress --test_output=errors - name: Integration Tests + # TODO(miraleung): Change this to //test/integration/... after the monolith rule removal. run: bazel --batch test //test/integration:asset //test/integration:compute //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:pubsub //test/integration:redis //test/integration:library --noshow_progress - uses: actions/upload-artifact@v2