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

Install buf and apply buf format #2094

Merged
merged 4 commits into from
Jun 28, 2023
Merged
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
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ REVIEWDOG_VERSION := $(eval REVIEWDOG_VERSION := $(shell cat versions/RE
TELEPRESENCE_VERSION := $(eval TELEPRESENCE_VERSION := $(shell cat versions/TELEPRESENCE_VERSION))$(TELEPRESENCE_VERSION)
VALDCLI_VERSION := $(eval VALDCLI_VERSION := $(shell cat versions/VALDCLI_VERSION))$(VALDCLI_VERSION)
YQ_VERSION := $(eval YQ_VERSION := $(shell cat versions/YQ_VERSION))$(YQ_VERSION)
BUF_VERSION := $(eval BUF_VERSION := $(shell cat versions/BUF_VERSION))$(BUF_VERSION)

OTEL_OPERATOR_RELEASE_NAME ?= opentelemetry-operator
PROMETHEUS_RELEASE_NAME ?= prometheus
Expand Down Expand Up @@ -396,7 +397,8 @@ format: \
format/go \
format/json \
format/md \
format/yaml
format/yaml \
format/proto

.PHONY: format/go
## run golines, gofumpt, goimports for all go files
Expand Down Expand Up @@ -448,6 +450,11 @@ format/json: \
"charts/**/*.json" \
"hack/**/*.json"

.PHONY: format/proto
format/proto: \
buf/install
buf format -w

.PHONY: deps
## resolve dependencies
deps: \
Expand Down
9 changes: 9 additions & 0 deletions Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,12 @@ textlint/install:
textlint/ci/install:
npm init -y
npm install --save-dev textlint textlint-rule-en-spell textlint-rule-prh textlint-rule-write-good

.PHONY: buf/install
buf/install: $(BINDIR)/buf

$(BINDIR)/buf:
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/$(BUF_VERSION)/buf-$(shell uname -s)-$(shell uname -m)" \
-o "${BINDIR}/buf" && \
chmod +x "${BINDIR}/buf"
9 changes: 3 additions & 6 deletions apis/proto/v1/agent/core/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/agent/core";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.agent.core";
option java_outer_classname = "ValdAgent";
option java_package = "org.vdaas.vald.api.v1.agent.core";

// Represent the agent service.
service Agent {

// Represent the creating index RPC.
rpc CreateIndex(payload.v1.Control.CreateIndexRequest)
returns (payload.v1.Empty) {
rpc CreateIndex(payload.v1.Control.CreateIndexRequest) returns (payload.v1.Empty) {
option (google.api.http).get = "/index/create";
}

Expand All @@ -41,8 +39,7 @@ service Agent {
}

// Represent the creating and saving index RPC.
rpc CreateAndSaveIndex(payload.v1.Control.CreateIndexRequest)
returns (payload.v1.Empty) {
rpc CreateAndSaveIndex(payload.v1.Control.CreateIndexRequest) returns (payload.v1.Empty) {
option (google.api.http).get = "/index/createandsave";
}

Expand Down
2 changes: 1 addition & 1 deletion apis/proto/v1/agent/sidecar/sidecar.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package sidecar.v1;

option go_package = "github.com/vdaas/vald/apis/grpc/v1/agent/sidecar";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.agent.sidecar";
option java_outer_classname = "ValdAgentSidecar";
option java_package = "org.vdaas.vald.api.v1.agent.sidecar";

// Represent the agent sidecar service.
service Sidecar {}
11 changes: 5 additions & 6 deletions apis/proto/v1/discoverer/discoverer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,24 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/discoverer";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.discoverer";
option java_outer_classname = "ValdDiscoverer";
option java_package = "org.vdaas.vald.api.v1.discoverer";

// Represent the discoverer service.
service Discoverer {

// Represent the RPC to get the agent pods information.
rpc Pods(payload.v1.Discoverer.Request) returns (payload.v1.Info.Pods) {
option (google.api.http) = {
post : "/discover/pods"
body : "*"
post: "/discover/pods"
body: "*"
};
}

// Represent the RPC to get the node information.
rpc Nodes(payload.v1.Discoverer.Request) returns (payload.v1.Info.Nodes) {
option (google.api.http) = {
post : "/discover/nodes"
body : "*"
post: "/discover/nodes"
body: "*"
};
}
}
17 changes: 7 additions & 10 deletions apis/proto/v1/filter/egress/egress_filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,24 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/filter/egress";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.filter.egress";
option java_outer_classname = "ValdEgressFilter";
option java_package = "org.vdaas.vald.api.v1.filter.egress";

// Represent the egress filter service.
service Filter {

// Represent the RPC to filter the distance.
rpc FilterDistance(payload.v1.Object.Distance)
returns (payload.v1.Object.Distance) {
rpc FilterDistance(payload.v1.Object.Distance) returns (payload.v1.Object.Distance) {
option (google.api.http) = {
post : "/filter/egress/distance"
body : "*"
post: "/filter/egress/distance"
body: "*"
};
}

// Represent the RPC to filter the vector.
rpc FilterVector(payload.v1.Object.Vector)
returns (payload.v1.Object.Vector) {
rpc FilterVector(payload.v1.Object.Vector) returns (payload.v1.Object.Vector) {
option (google.api.http) = {
post : "/filter/egress/vector"
body : "*"
post: "/filter/egress/vector"
body: "*"
};
}
}
14 changes: 6 additions & 8 deletions apis/proto/v1/filter/ingress/ingress_filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,24 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/filter/ingress";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.filter.ingress";
option java_outer_classname = "ValdIngressFilter";
option java_package = "org.vdaas.vald.api.v1.filter.ingress";

// Represent the ingress filter service.
service Filter {

// Represent the RPC to generate the vector.
rpc GenVector(payload.v1.Object.Blob) returns (payload.v1.Object.Vector) {
option (google.api.http) = {
post : "/filter/ingress/object"
body : "*"
post: "/filter/ingress/object"
body: "*"
};
}

// Represent the RPC to filter the vector.
rpc FilterVector(payload.v1.Object.Vector)
returns (payload.v1.Object.Vector) {
rpc FilterVector(payload.v1.Object.Vector) returns (payload.v1.Object.Vector) {
option (google.api.http) = {
post : "/filter/ingress/vector"
body : "*"
post: "/filter/ingress/vector"
body: "*"
};
}
}
3 changes: 1 addition & 2 deletions apis/proto/v1/manager/index/index_manager.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/manager/index";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.manager.index";
option java_outer_classname = "ValdIndexManager";
option java_package = "org.vdaas.vald.api.v1.manager.index";

// Represent the index manager service.
service Index {

// Represent the RPC to get the index information.
rpc IndexInfo(payload.v1.Empty) returns (payload.v1.Info.Index.Count) {
option (google.api.http).get = "/index/info";
Expand Down
Loading