Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump protobufs and grpc #1453

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ 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-go-grpc-version = 1.5.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-go-grpc = $(GOPATH)/bin/protoc-gen-go-grpc
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 +68,48 @@ $(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-go-grpc binary.
$(protoc-gen-go-grpc):
@echo "+ $@"
@echo "Installing protoc-gen-go-grpc $(protoc-gen-go-grpc-version) to $(protoc-gen-go-grpc)"
@cd /tmp; go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(protoc-gen-go-grpc-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-go-grpc) $(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 +118,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 Expand Up @@ -185,7 +194,7 @@ bats-e2e-tests:
.PHONY: go-e2e-tests
go-e2e-tests: proto-generated-srcs
@kubectl apply -f workflows/
@go test ./test/e2e/... -tags=e2e -v -parallel 5 -count 1 -cover -timeout 1h
@go test ./test/e2e/... -tags=e2e2 -v -parallel 5 -count 1 -cover -timeout 1h -json

# Assuming a local dev infra server is running and accessible via a port-forward
# i.e. nohup kubectl -n infra port-forward svc/infra-server-service 8443:8443 &
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
Loading