Skip to content

Commit

Permalink
bump protobufs and grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
tommartensen committed Jan 3, 2025
1 parent 2b8b7b6 commit b8ebff7
Show file tree
Hide file tree
Showing 17 changed files with 3,266 additions and 2,775 deletions.
35 changes: 18 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ image-name:
## Protobuf ##
##############
# Tool versions.
protoc-version = 3.11.2
protoc-gen-go-version = 1.3.2
protoc-gen-grpc-gateway-version = 1.12.1
protoc-gen-swagger-version = 1.12.1
protoc-version = 29.2
protoc-gen-go-version = 1.36.1
protoc-gen-grpc-gateway-version = 2.25.1
protoc-gen-openapiv2-version = 2.25.1

# Tool binary paths
protoc = $(GOPATH)/bin/protoc
protoc-gen-go = $(GOPATH)/bin/protoc-gen-go
protoc-gen-grpc-gateway = $(GOPATH)/bin/protoc-gen-grpc-gateway
protoc-gen-swagger = $(GOPATH)/bin/protoc-gen-swagger
protoc-gen-openapiv2 = $(GOPATH)/bin/protoc-gen-openapiv2

# The protoc zip url changes depending on if we're running in CI or not.
ifeq ($(shell uname -s),Linux)
Expand All @@ -66,41 +66,42 @@ $(protoc):
$(protoc-gen-go):
@echo "+ $@"
@echo "Installing protoc-gen-go $(protoc-gen-go-version) to $(protoc-gen-go)"
@cd /tmp; go install github.com/golang/protobuf/protoc-gen-go@v$(protoc-gen-go-version)
@cd /tmp; go install google.golang.org/protobuf/cmd/protoc-gen-go@v$(protoc-gen-go-version)

# This target installs the protoc-gen-grpc-gateway binary.
$(protoc-gen-grpc-gateway):
@echo "+ $@"
@echo "Installing protoc-gen-grpc-gateway $(protoc-gen-grpc-gateway-version) to $(protoc-gen-grpc-gateway)"
@cd /tmp; go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v$(protoc-gen-grpc-gateway-version)
@cd /tmp; go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v$(protoc-gen-grpc-gateway-version)

# This target installs the protoc-gen-swagger binary.
$(protoc-gen-swagger):
# This target installs the protoc-gen-openapiv2 binary.
$(protoc-gen-openapiv2):
@echo "+ $@"
@echo "Installing protoc-gen-swagger $(protoc-gen-swagger-version) to $(protoc-gen-swagger)"
@cd /tmp; go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v$(protoc-gen-swagger-version)
@echo "Installing protoc-gen-openapiv2 $(protoc-gen-openapiv2-version) to $(protoc-gen-openapiv2)"
@cd /tmp; go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v$(protoc-gen-openapiv2-version)

# This target installs all of the protoc related binaries.
.PHONY: protoc-tools
protoc-tools: $(protoc) $(protoc-gen-go) $(protoc-gen-grpc-gateway) $(protoc-gen-swagger)
protoc-tools: $(protoc) $(protoc-gen-go) $(protoc-gen-grpc-gateway) $(protoc-gen-openapiv2)

PROTO_INPUT_DIR = proto/api/v1
PROTO_THIRD_PARTY = proto/third_party
PROTO_FILES = service.proto
PROTO_OUTPUT_DIR = generated/api/v1
PROTO_OUTPUT_DIR = generated

# This target compiles proto files into:
# - Go gRPC bindings
# - Go gRPC-Gateway bindings
# - JSON Swagger definitions file
# - JSON OpenAPI v2 (Swagger) definitions file
.PHONY: proto-generated-srcs
proto-generated-srcs: protoc-tools
@echo "+ $@"
@mkdir -p $(PROTO_OUTPUT_DIR)
# Generate gRPC bindings
$(protoc) -I$(PROTO_INPUT_DIR) \
-I$(PROTO_THIRD_PARTY) \
--go_out=plugins=grpc:$(PROTO_OUTPUT_DIR) \
--go_out=$(PROTO_OUTPUT_DIR) \
--go-grpc_out=$(PROTO_OUTPUT_DIR) \
$(PROTO_FILES)

# Generate gRPC-Gateway bindings
Expand All @@ -109,10 +110,10 @@ proto-generated-srcs: protoc-tools
--grpc-gateway_out=logtostderr=true:$(PROTO_OUTPUT_DIR) \
$(PROTO_FILES)

# Generate JSON Swagger manifest
# Generate JSON OpenAPI manifest
$(protoc) -I$(PROTO_INPUT_DIR) \
-I$(PROTO_THIRD_PARTY) \
--swagger_out=logtostderr=true:$(PROTO_OUTPUT_DIR) \
--openapiv2_out=logtostderr=true:$(PROTO_OUTPUT_DIR)/api/v1 \
$(PROTO_FILES)

###########
Expand Down
2 changes: 2 additions & 0 deletions cmd/infractl/cluster/get/fancy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
)

type FakeClusterServiceClient struct {
v1.UnimplementedClusterServiceServer

infoFn func(ctx context.Context, clusterID *v1.ResourceByID) (*v1.Cluster, error)
listFn func(ctx context.Context, req *v1.ClusterListRequest) (*v1.ClusterListResponse, error)
lifespanFn func(ctx context.Context, req *v1.LifespanRequest) (*durationpb.Duration, error)
Expand Down
Loading

0 comments on commit b8ebff7

Please sign in to comment.