Skip to content

Commit

Permalink
deps: update protobuf to 3.14 (#14253)
Browse files Browse the repository at this point in the history
There is an unfortunate change in 3.14 that changed go_package for WKT, which necessitates updating several go dependencies as well:

protoc-gen-validate to 2020-11-30
transitive dependencies from protoc-gen-validate
gazelle to 0.22.2
rules_go to 0.25.0
go to 1.15.5

Risk Level: low

Signed-off-by: Kuat Yessenov <kuat@google.com>
Co-authored-by: Lizan Zhou <lizan@tetrate.io>
  • Loading branch information
kyessenov and lizan committed Dec 16, 2020
1 parent ffbf952 commit b3bb0f9
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .azure-pipelines/bazel.yml
Expand Up @@ -66,6 +66,8 @@ steps:
- bash: |
echo "disk space at end of build:"
df -h
# Cleanup offending files with unicode names
rm -rf $(Build.StagingDirectory)/tmp/*/*/external/go_sdk/test/fixedbugs
displayName: "Check disk space at end"
condition: always()
Expand Down
16 changes: 8 additions & 8 deletions api/bazel/api_build_system.bzl
Expand Up @@ -186,14 +186,14 @@ def api_proto_package(
proto = name,
visibility = ["//visibility:public"],
deps = depset([_go_proto_mapping(dep) for dep in deps] + [
"@com_github_golang_protobuf//ptypes:go_default_library",
"@com_github_golang_protobuf//ptypes/any:go_default_library",
"@com_github_golang_protobuf//ptypes/duration:go_default_library",
"@com_github_golang_protobuf//ptypes/struct:go_default_library",
"@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
"@com_github_golang_protobuf//ptypes/wrappers:go_default_library",
"@com_envoyproxy_protoc_gen_validate//validate:go_default_library",
"@com_google_googleapis//google/api:annotations_go_proto",
"@com_google_googleapis//google/rpc:status_go_proto",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@go_googleapis//google/api:annotations_go_proto",
"@go_googleapis//google/rpc:status_go_proto",
"@io_bazel_rules_go//proto/wkt:any_go_proto",
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
]).to_list(),
)
19 changes: 13 additions & 6 deletions api/bazel/repository_locations.bzl
Expand Up @@ -14,23 +14,30 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "protoc-gen-validate (PGV)",
project_desc = "protoc plugin to generate polyglot message validators",
project_url = "https://github.com/envoyproxy/protoc-gen-validate",
version = "278964a8052f96a2f514add0298098f63fb7f47f",
sha256 = "e368733c9fb7f8489591ffaf269170d7658cc0cd1ee322b601512b769446d3c8",
version = "1bcea29601b5624234a19b3d7f0ebd9e9984f583",
sha256 = "2062bbe50eddf3c98490339721fb02b5b5cd78f610f163b98bbf95ba7105553f",
strip_prefix = "protoc-gen-validate-{version}",
urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/{version}.tar.gz"],
release_date = "2020-06-08",
release_date = "2020-11-30",
use_category = ["api"],
implied_untracked_deps = [
"com_github_iancoleman_strcase",
"com_github_lyft_protoc_gen_star",
"com_github_spf13_afero",
"org_golang_google_genproto",
"org_golang_x_text",
],
),
com_github_cncf_udpa = dict(
project_name = "xDS API",
project_desc = "xDS API Working Group (xDS-WG)",
project_url = "https://github.com/cncf/udpa",
# During the UDPA -> xDS migration, we aren't working with releases.
version = "5459f2c994033b0afed7e4a70ac7e90c90c1ffee",
sha256 = "c1f5c2438cf725b5f66aa4210dbc4bb691020c5ed4f64d2bc6638b06a11482f1",
version = "cc1b757b3eddccaaaf0743cbb107742bb7e3ee4f",
sha256 = "822a007cf155855d0c08a2e753a39e222e5816b904436196244066a818a8a230",
strip_prefix = "udpa-{version}",
urls = ["https://github.com/cncf/udpa/archive/{version}.tar.gz"],
release_date = "2020-11-20",
release_date = "2020-12-11",
use_category = ["api"],
),
com_github_openzipkin_zipkinapi = dict(
Expand Down
2 changes: 0 additions & 2 deletions api/test/build/BUILD
Expand Up @@ -23,11 +23,9 @@ api_go_test(
deps = [
"//envoy/api/v2:pkg_go_proto",
"//envoy/api/v2/auth:pkg_go_proto",
"//envoy/config/bootstrap/v2:pkg_go_proto",
"//envoy/service/accesslog/v2:pkg_go_proto",
"//envoy/service/discovery/v2:pkg_go_proto",
"//envoy/service/metrics/v2:pkg_go_proto",
"//envoy/service/ratelimit/v2:pkg_go_proto",
"//envoy/service/trace/v2:pkg_go_proto",
],
)
2 changes: 0 additions & 2 deletions api/test/build/go_build_test.go
Expand Up @@ -5,12 +5,10 @@ import (

_ "github.com/envoyproxy/go-control-plane/envoy/api/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth"
_ "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/service/accesslog/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/service/metrics/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/service/ratelimit/v2"
_ "github.com/envoyproxy/go-control-plane/envoy/service/trace/v2"
)

func TestNoop(t *testing.T) {
Expand Down
20 changes: 19 additions & 1 deletion bazel/dependency_imports.bzl
Expand Up @@ -16,7 +16,7 @@ load("@rules_antlr//antlr:deps.bzl", "antlr_dependencies")
load("@proxy_wasm_rust_sdk//bazel:dependencies.bzl", "proxy_wasm_rust_sdk_dependencies")

# go version for rules_go
GO_VERSION = "1.14.7"
GO_VERSION = "1.15.5"

def envoy_dependency_imports(go_version = GO_VERSION):
rules_foreign_cc_dependencies()
Expand Down Expand Up @@ -57,6 +57,24 @@ def envoy_dependency_imports(go_version = GO_VERSION):
sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=",
version = "v0.3.0",
)
go_repository(
name = "com_github_spf13_afero",
importpath = "github.com/spf13/afero",
sum = "h1:8q6vk3hthlpb2SouZcnBVKboxWQWMDNF38bwholZrJc=",
version = "v1.3.4",
)
go_repository(
name = "com_github_lyft_protoc_gen_star",
importpath = "github.com/lyft/protoc-gen-star",
sum = "h1:sImehRT+p7lW9n6R7MQc5hVgzWGEkDVZU4AsBQ4Isu8=",
version = "v0.5.1",
)
go_repository(
name = "com_github_iancoleman_strcase",
importpath = "github.com/iancoleman/strcase",
sum = "h1:ux/56T2xqZO/3cP1I2F86qpeoYPCOzk+KF/UH/Ar+lk=",
version = "v0.0.0-20180726023541-3605ed457bf7",
)

config_validation_pip_install()
configs_pip_install()
Expand Down
14 changes: 14 additions & 0 deletions bazel/protobuf.patch
Expand Up @@ -21,3 +21,17 @@ index efc3d8e7f..746ad4851 100644

################################################################################
# Protobuf Runtime Library
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index 97ac28028..8b7585d9d 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -31,3 +31,9 @@
# Copyright 2007 Google Inc. All Rights Reserved.

__version__ = '3.14.0'
+
+if __name__ != '__main__':
+ try:
+ __import__('pkg_resources').declare_namespace(__name__)
+ except ImportError:
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
18 changes: 9 additions & 9 deletions bazel/repository_locations.bzl
Expand Up @@ -15,10 +15,10 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Gazelle",
project_desc = "Bazel BUILD file generator for Go projects",
project_url = "https://github.com/bazelbuild/bazel-gazelle",
version = "0.21.1",
sha256 = "cdb02a887a7187ea4d5a27452311a75ed8637379a1287d8eeb952138ea485f7d",
version = "0.22.2",
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v{version}/bazel-gazelle-v{version}.tar.gz"],
release_date = "2020-05-28",
release_date = "2020-10-02",
use_category = ["build"],
),
bazel_toolchains = dict(
Expand Down Expand Up @@ -495,12 +495,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Protocol Buffers",
project_desc = "Language-neutral, platform-neutral extensible mechanism for serializing structured data",
project_url = "https://developers.google.com/protocol-buffers",
version = "3.13.0",
sha256 = "465fd9367992a9b9c4fba34a549773735da200903678b81b25f367982e8df376",
version = "3.14.0",
sha256 = "6dd0f6b20094910fbb7f1f7908688df01af2d4f6c5c21331b9f636048674aebf",
strip_prefix = "protobuf-{version}",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v{version}/protobuf-all-{version}.tar.gz"],
use_category = ["dataplane_core", "controlplane"],
release_date = "2020-08-14",
release_date = "2020-11-13",
cpe = "cpe:2.3:a:google:protobuf:*",
),
grpc_httpjson_transcoding = dict(
Expand All @@ -520,11 +520,11 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Go rules for Bazel",
project_desc = "Bazel rules for the Go language",
project_url = "https://github.com/bazelbuild/rules_go",
version = "0.23.7",
sha256 = "0310e837aed522875791750de44408ec91046c630374990edd51827cb169f616",
version = "0.25.0",
sha256 = "6f111c57fd50baf5b8ee9d63024874dd2a014b069426156c55adbf6d3d22cb7b",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.tar.gz"],
use_category = ["build", "api"],
release_date = "2020-08-06",
release_date = "2020-12-02",
implied_untracked_deps = [
"com_github_golang_protobuf",
"io_bazel_rules_nogo",
Expand Down
16 changes: 8 additions & 8 deletions generated_api_shadow/bazel/api_build_system.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions generated_api_shadow/bazel/repository_locations.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions source/common/config/protobuf_link_hacks.h
Expand Up @@ -47,6 +47,7 @@ const envoy::service::route::v3::RdsDummy _rds_dummy_v3;
const envoy::service::cluster::v3::CdsDummy _cds_dummy_v3;
const envoy::service::endpoint::v3::EdsDummy _eds_dummy_v3;
const envoy::service::route::v3::SrdsDummy _srds_dummy_v3;
const envoy::service::extension::v3::EcdsDummy _ecds_dummy_v3;

// With the v2 -> v3 migration there is another, related linking issue.
// Symbols for v2 protos which headers are not included in any file in the codebase are being
Expand Down
2 changes: 1 addition & 1 deletion test/common/access_log/access_log_impl_test.cc
Expand Up @@ -1137,7 +1137,7 @@ name: accesslog
)EOF";

EXPECT_THROW_WITH_REGEX(AccessLogFactory::fromProto(parseAccessLogFromV3Yaml(yaml), context_),
EnvoyException, ".*\"NOT_A_VALID_CODE\" for type TYPE_ENUM.*");
EnvoyException, "NOT_A_VALID_CODE");
}

TEST_F(AccessLogImplTest, GrpcStatusFilterBlock) {
Expand Down
2 changes: 1 addition & 1 deletion test/common/upstream/cluster_manager_impl_test.cc
Expand Up @@ -302,7 +302,7 @@ TEST_F(ClusterManagerImplTest, UnknownClusterType) {
)EOF";

EXPECT_THROW_WITH_REGEX(create(parseBootstrapFromV3Json(json)), EnvoyException,
"invalid value \"foo\" for type TYPE_ENUM");
"invalid value \"foo\"");
}

TEST_F(ClusterManagerImplTest, LocalClusterNotDefined) {
Expand Down
1 change: 1 addition & 0 deletions test/common/upstream/eds_speed_test.cc
Expand Up @@ -10,6 +10,7 @@

#include "common/config/grpc_mux_impl.h"
#include "common/config/grpc_subscription_impl.h"
#include "common/config/protobuf_link_hacks.h"
#include "common/config/utility.h"
#include "common/singleton/manager_impl.h"
#include "common/upstream/eds.h"
Expand Down
7 changes: 2 additions & 5 deletions test/common/upstream/upstream_impl_test.cc
Expand Up @@ -1917,7 +1917,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) {
socket_address: { address: 192.168.1.2, port_value: 44 }
)EOF";

EXPECT_THROW_WITH_MESSAGE(
EXPECT_THROW_WITH_REGEX(
{
envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml);
Envoy::Stats::ScopePtr scope =
Expand All @@ -1930,10 +1930,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) {
StaticClusterImpl cluster(cluster_config, runtime_, factory_context, std::move(scope),
false);
},
EnvoyException,
"Protobuf message (type envoy.config.cluster.v3.Cluster reason "
"INVALID_ARGUMENT:(lb_policy): invalid "
"value \"fakelbtype\" for type TYPE_ENUM) has unknown fields");
EnvoyException, "invalid value \"fakelbtype\"");
}

TEST_F(StaticClusterImplTest, MalformedHostIP) {
Expand Down
3 changes: 3 additions & 0 deletions test/extensions/filters/http/compressor/config_test.cc
@@ -1,5 +1,6 @@
#include "extensions/filters/http/compressor/config.h"

#include "test/extensions/filters/http/compressor/mock_compressor_library.pb.h"
#include "test/mocks/server/factory_context.h"

#include "gtest/gtest.h"
Expand All @@ -12,6 +13,8 @@ namespace {

using testing::NiceMock;

const ::test::mock_compressor_library::Unregistered _mock_compressor_library_dummy;

TEST(CompressorFilterFactoryTests, MissingCompressorLibraryConfig) {
const envoy::extensions::filters::http::compressor::v3::Compressor proto_config;
CompressorFilterFactory factory;
Expand Down
1 change: 1 addition & 0 deletions test/integration/BUILD
Expand Up @@ -892,6 +892,7 @@ envoy_cc_test(
"//test/mocks/http:http_mocks",
"//test/test_common:utility_lib",
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
"@envoy_api//envoy/config/filter/http/grpc_http1_bridge/v2:pkg_cc_proto",
"@envoy_api//envoy/config/route/v3:pkg_cc_proto",
"@envoy_api//envoy/extensions/filters/network/http_connection_manager/v3:pkg_cc_proto",
],
Expand Down
3 changes: 3 additions & 0 deletions test/integration/integration_test.cc
Expand Up @@ -3,6 +3,7 @@
#include <string>

#include "envoy/config/bootstrap/v3/bootstrap.pb.h"
#include "envoy/config/filter/http/grpc_http1_bridge/v2/config.pb.h"
#include "envoy/config/route/v3/route_components.pb.h"
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h"

Expand Down Expand Up @@ -418,6 +419,8 @@ TEST_P(IntegrationTest, UpstreamDisconnectWithTwoRequests) {
test_server_->waitForCounterGe("cluster.cluster_0.upstream_rq_200", 2);
}

const ::envoy::config::filter::http::grpc_http1_bridge::v2::Config _grpc_http1_bridge_dummy;

// Test hitting the bridge filter with too many response bytes to buffer. Given
// the headers are not proxied, the connection manager will send a local error reply.
TEST_P(IntegrationTest, HittingGrpcFilterLimitBufferingHeaders) {
Expand Down

0 comments on commit b3bb0f9

Please sign in to comment.