From 480be249b5bb9e4037737c58ee5b445b0e6b5b0f Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Tue, 3 Oct 2023 23:29:41 +0300 Subject: [PATCH 1/3] googleapis --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 57713a2..437ffa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,13 @@ RUN apk -U --no-cache add bash git protobuf curl &&\ go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest &&\ go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &&\ # cloning well-known-types - # only use needed files git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo &&\ mv /protobuf-repo/src/ /protobuf/ &&\ - rm -rf /protobuf-repo &&\ + # cloning googleapis-types + git clone --depth=1 https://github.com/googleapis/googleapis.git /googleapis-repo &&\ + mv /googleapis-repo/src/ /protobuf/googleapis &&\ # cleanup + rm -rf /protobuf-repo /googleapis-repo &&\ find /protobuf -not -name "*.proto" -type f -delete &&\ apk del git &&\ apk -v cache clean From 5ec34bd655f5fd19c5c535f062952f5c3cdfcb6c Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Tue, 3 Oct 2023 23:30:38 +0300 Subject: [PATCH 2/3] googleapis --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 437ffa1..74acdbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,9 @@ RUN apk -U --no-cache add bash git protobuf curl &&\ git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo &&\ mv /protobuf-repo/src/ /protobuf/ &&\ # cloning googleapis-types - git clone --depth=1 https://github.com/googleapis/googleapis.git /googleapis-repo &&\ - mv /googleapis-repo/src/ /protobuf/googleapis &&\ + git clone --depth=1 https://github.com/googleapis/googleapis.git /protobuf/googleapis &&\ # cleanup - rm -rf /protobuf-repo /googleapis-repo &&\ + rm -rf /protobuf-repo &&\ find /protobuf -not -name "*.proto" -type f -delete &&\ apk del git &&\ apk -v cache clean From 216515fca97f098fbb85574e1f8454591d95bdd0 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Sat, 7 Oct 2023 00:59:19 +0300 Subject: [PATCH 3/3] fix googleapis --- .dockerignore | 2 +- Dockerfile | 2 +- example/well_known_types/wkt.proto | 8 +++++++- gripmock.go | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 45a6800..328cc43 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -assets +deployments .git .github *.pb.go \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 74acdbb..2c79da3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk -U --no-cache add bash git protobuf curl &&\ git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo &&\ mv /protobuf-repo/src/ /protobuf/ &&\ # cloning googleapis-types - git clone --depth=1 https://github.com/googleapis/googleapis.git /protobuf/googleapis &&\ + git clone --depth=1 https://github.com/googleapis/googleapis.git /googleapis &&\ # cleanup rm -rf /protobuf-repo &&\ find /protobuf -not -name "*.proto" -type f -delete &&\ diff --git a/example/well_known_types/wkt.proto b/example/well_known_types/wkt.proto index dfeb3f8..28891bc 100644 --- a/example/well_known_types/wkt.proto +++ b/example/well_known_types/wkt.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package well_known_types; +import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/api.proto"; @@ -10,5 +11,10 @@ service Gripmock { // this shows us example on using WKT as dependency // api.proto in particular has go_package alias with semicolon // "google.golang.org/genproto/protobuf/api;api" - rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api); + rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api) { + option (google.api.http) = { + post: "/v1/gripmock/api-info" + body: "*" + }; + } } diff --git a/gripmock.go b/gripmock.go index 0ba4035..1443522 100644 --- a/gripmock.go +++ b/gripmock.go @@ -28,7 +28,7 @@ func main() { adminport := flag.String("admin-port", "4771", "Port of stub admin server") adminBindAddr := flag.String("admin-listen", "0.0.0.0", "Adress the admin server will bind to. Default to localhost, set to 0.0.0.0 to use from another machine") stubPath := flag.String("stub", "", "Path where the stub files are (Optional)") - imports := flag.String("imports", "/protobuf", "comma separated imports path. default path /protobuf is where gripmock Dockerfile install WKT protos") + imports := flag.String("imports", "/protobuf,/googleapis", "comma separated imports path. default path /protobuf,/googleapis is where gripmock Dockerfile install WKT protos") // for backwards compatibility if os.Args[1] == "gripmock" { os.Args = append(os.Args[:1], os.Args[2:]...)