From 18b0e2a6ddfbcd27d9f0620618941512f616f9cf Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Thu, 17 May 2018 22:58:34 +0000 Subject: [PATCH] metrics_service, als, trace_service: add api_go_grpc bazel rules (#3409) Add api_go_grpc rules for metrics_service, als, and trace_service. To support those changes, also added the necessary go_proto_library rules in the repositories.bzl definitions for prometheus_metrics_model, and io_opencensus_trace, and augmented the go_build_test.go to verify these changes were correct. Signed-off-by: William Chang Mirrored from https://github.com/envoyproxy/envoy @ fb7797fd7df696cd239cc1d3792719361b62c684 --- bazel/repositories.bzl | 18 ++++++++++++++++-- envoy/service/accesslog/v2/BUILD | 11 ++++++++++- envoy/service/metrics/v2/BUILD | 9 +++++++++ envoy/service/trace/v2/BUILD | 11 ++++++++++- test/build/BUILD | 3 +++ test/build/go_build_test.go | 3 +++ 6 files changed, 51 insertions(+), 4 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 0e6a449a..673ba20a 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -194,6 +194,7 @@ py_proto_library( url = "https://github.com/prometheus/client_model/archive/" + PROMETHEUS_SHA + ".tar.gz", build_file_content = """ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") api_proto_library( name = "client_model", @@ -202,6 +203,13 @@ api_proto_library( ], visibility = ["//visibility:public"], ) + +go_proto_library( + name = "client_model_go_proto", + importpath = "client_model", + proto = ":client_model", + visibility = ["//visibility:public"], +) """, ) @@ -211,6 +219,7 @@ api_proto_library( url = "https://github.com/census-instrumentation/opencensus-proto/archive/" + OPENCENSUS_SHA + ".tar.gz", build_file_content = """ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") api_proto_library( name = "trace_model", @@ -219,7 +228,12 @@ api_proto_library( ], visibility = ["//visibility:public"], ) + +go_proto_library( + name = "trace_model_go_proto", + importpath = "trace_model", + proto = ":trace_model", + visibility = ["//visibility:public"], +) """, ) - - diff --git a/envoy/service/accesslog/v2/BUILD b/envoy/service/accesslog/v2/BUILD index cdf5b36a..b458c80e 100644 --- a/envoy/service/accesslog/v2/BUILD +++ b/envoy/service/accesslog/v2/BUILD @@ -1,4 +1,4 @@ -load("//bazel:api_build_system.bzl", "api_proto_library") +load("//bazel:api_build_system.bzl", "api_proto_library", "api_go_grpc_library") licenses(["notice"]) # Apache 2 @@ -12,3 +12,12 @@ api_proto_library( "//envoy/config/filter/accesslog/v2:accesslog", ], ) + +api_go_grpc_library( + name = "als", + proto = ":als", + deps = [ + "//envoy/api/v2/core:base_go_proto", + "//envoy/config/filter/accesslog/v2:accesslog_go_proto", + ], +) diff --git a/envoy/service/metrics/v2/BUILD b/envoy/service/metrics/v2/BUILD index cdaf519d..2559f1d4 100644 --- a/envoy/service/metrics/v2/BUILD +++ b/envoy/service/metrics/v2/BUILD @@ -13,3 +13,12 @@ api_proto_library( "@promotheus_metrics_model//:client_model", ], ) + +api_go_grpc_library( + name = "metrics_service", + proto = ":metrics_service", + deps = [ + "//envoy/api/v2/core:base_go_proto", + "@promotheus_metrics_model//:client_model_go_proto", + ], +) diff --git a/envoy/service/trace/v2/BUILD b/envoy/service/trace/v2/BUILD index ecd4d504..4b3ba5dc 100644 --- a/envoy/service/trace/v2/BUILD +++ b/envoy/service/trace/v2/BUILD @@ -1,4 +1,4 @@ -load("//bazel:api_build_system.bzl", "api_proto_library") +load("//bazel:api_build_system.bzl", "api_proto_library", "api_go_grpc_library") licenses(["notice"]) # Apache 2 @@ -12,3 +12,12 @@ api_proto_library( "@io_opencensus_trace//:trace_model", ], ) + +api_go_grpc_library( + name = "trace_service", + proto = ":trace_service", + deps = [ + "//envoy/api/v2/core:base_go_proto", + "@io_opencensus_trace//:trace_model_go_proto", + ], +) diff --git a/test/build/BUILD b/test/build/BUILD index 2605b7c2..fae9de9c 100644 --- a/test/build/BUILD +++ b/test/build/BUILD @@ -30,9 +30,12 @@ api_go_test( "//envoy/api/v2:rds_go_grpc", "//envoy/api/v2/auth:cert_go_proto", "//envoy/config/bootstrap/v2:bootstrap_go_proto", + "//envoy/service/accesslog/v2:als_go_grpc", "//envoy/service/discovery/v2:ads_go_grpc", "//envoy/service/discovery/v2:hds_go_grpc", "//envoy/service/discovery/v2:sds_go_grpc", + "//envoy/service/metrics/v2:metrics_service_go_grpc", "//envoy/service/ratelimit/v2:rls_go_grpc", + "//envoy/service/trace/v2:trace_service_go_grpc", ], ) diff --git a/test/build/go_build_test.go b/test/build/go_build_test.go index bf6959a6..d667a1a1 100644 --- a/test/build/go_build_test.go +++ b/test/build/go_build_test.go @@ -13,6 +13,9 @@ import ( _ "github.com/envoyproxy/data-plane-api/api/rds" _ "github.com/envoyproxy/data-plane-api/api/rls" _ "github.com/envoyproxy/data-plane-api/api/sds" + _ "github.com/envoyproxy/data-plane-api/api/als" + _ "github.com/envoyproxy/data-plane-api/api/metrics_service" + _ "github.com/envoyproxy/data-plane-api/api/trace_service" ) func TestNoop(t *testing.T) {