fix: Protobuf docker (#11472)
* fix docker * revert comment removal * revert and push
This commit is contained in:
parent
b2d50a1ed1
commit
cc0b9dfe0a
|
@ -13,20 +13,13 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# set VERSION to new version when making changes, when merged to master the image will automatically be pushed
|
||||
- uses: actions/checkout@v3
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=tendermintdev/sdk-proto-gen
|
||||
VERSION=noop
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
|
||||
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
|
||||
VERSION=latest
|
||||
fi
|
||||
fi
|
||||
VERSION=v0.6
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -393,7 +393,7 @@ devdoc-update:
|
|||
### Protobuf ###
|
||||
###############################################################################
|
||||
|
||||
protoVer=v0.5
|
||||
protoVer=v0.6
|
||||
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
|
||||
containerProtoGen=$(PROJECT_NAME)-proto-gen-$(protoVer)
|
||||
containerProtoGenAny=$(PROJECT_NAME)-proto-gen-any-$(protoVer)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,6 +26,9 @@ type QueryClient interface {
|
|||
Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error)
|
||||
// AllBalances queries the balance of all coins for a single account.
|
||||
AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error)
|
||||
// SpendableBalances queries the spenable balance of all coins for a single
|
||||
// account.
|
||||
SpendableBalances(ctx context.Context, in *QuerySpendableBalancesRequest, opts ...grpc.CallOption) (*QuerySpendableBalancesResponse, error)
|
||||
// TotalSupply queries the total supply of all coins.
|
||||
TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error)
|
||||
// SupplyOf queries the supply of a single coin.
|
||||
|
@ -68,6 +71,15 @@ func (c *queryClient) AllBalances(ctx context.Context, in *QueryAllBalancesReque
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) SpendableBalances(ctx context.Context, in *QuerySpendableBalancesRequest, opts ...grpc.CallOption) (*QuerySpendableBalancesResponse, error) {
|
||||
out := new(QuerySpendableBalancesResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/SpendableBalances", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) {
|
||||
out := new(QueryTotalSupplyResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/TotalSupply", in, out, opts...)
|
||||
|
@ -130,6 +142,9 @@ type QueryServer interface {
|
|||
Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error)
|
||||
// AllBalances queries the balance of all coins for a single account.
|
||||
AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error)
|
||||
// SpendableBalances queries the spenable balance of all coins for a single
|
||||
// account.
|
||||
SpendableBalances(context.Context, *QuerySpendableBalancesRequest) (*QuerySpendableBalancesResponse, error)
|
||||
// TotalSupply queries the total supply of all coins.
|
||||
TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error)
|
||||
// SupplyOf queries the supply of a single coin.
|
||||
|
@ -157,6 +172,9 @@ func (UnimplementedQueryServer) Balance(context.Context, *QueryBalanceRequest) (
|
|||
func (UnimplementedQueryServer) AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AllBalances not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) SpendableBalances(context.Context, *QuerySpendableBalancesRequest) (*QuerySpendableBalancesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SpendableBalances not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented")
|
||||
}
|
||||
|
@ -224,6 +242,24 @@ func _Query_AllBalances_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_SpendableBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QuerySpendableBalancesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).SpendableBalances(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.bank.v1beta1.Query/SpendableBalances",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).SpendableBalances(ctx, req.(*QuerySpendableBalancesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryTotalSupplyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -347,6 +383,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "AllBalances",
|
||||
Handler: _Query_AllBalances_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SpendableBalances",
|
||||
Handler: _Query_SpendableBalances_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "TotalSupply",
|
||||
Handler: _Query_TotalSupply_Handler,
|
||||
|
|
|
@ -9,21 +9,18 @@ RUN apk add --no-cache \
|
|||
make
|
||||
|
||||
ENV GOLANG_PROTOBUF_VERSION=1.28.0 \
|
||||
GOGO_PROTOBUF_VERSION=1.3.3-alpha.regen.1 \
|
||||
GOGO_PROTOBUF_VERSION=1.3.2 \
|
||||
GRPC_GATEWAY_VERSION=1.16.0
|
||||
|
||||
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
|
||||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION}
|
||||
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}
|
||||
RUN go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest
|
||||
## For the moment there is a problem with go install and replace, so installing
|
||||
## by cloninng the repository instead
|
||||
#RUN go get github.com/regen-network/protobuf/protoc-gen-gogo@v${GOGO_PROTOBUF_VERSION} \
|
||||
# github.com/regen-network/protobuf/protoc-gen-gogofast@v${GOGO_PROTOBUF_VERSION} \
|
||||
# github.com/regen-network/protobuf/protoc-gen-gogofaster@v${GOGO_PROTOBUF_VERSION}
|
||||
|
||||
RUN git clone https://github.com/regen-network/protobuf.git; cd protobuf; go mod download; make install
|
||||
RUN GO111MODULE=on go get github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest \
|
||||
google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} \
|
||||
github.com/gogo/protobuf/protoc-gen-gogo@v${GOGO_PROTOBUF_VERSION} \
|
||||
github.com/gogo/protobuf/protoc-gen-gogofast@v${GOGO_PROTOBUF_VERSION} \
|
||||
github.com/gogo/protobuf/protoc-gen-gogofaster@v${GOGO_PROTOBUF_VERSION} \
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} \
|
||||
github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest
|
||||
|
||||
|
||||
RUN npm install -g swagger-combine
|
||||
|
|
|
@ -1,24 +1,36 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#== Requirements ==
|
||||
#
|
||||
## make sure your `go env GOPATH` is in the `$PATH`
|
||||
## Install:
|
||||
## + latest buf (v1.0.0-rc11 or later)
|
||||
## + protobuf v3
|
||||
#
|
||||
## All protoc dependencies must be installed not in the module scope
|
||||
## currently we must use grpc-gateway v1
|
||||
# cd ~
|
||||
# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
# go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
# go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0
|
||||
# go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
|
||||
# go get github.com/regen-network/cosmos-proto@latest # doesn't work in install mode
|
||||
# go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v0.3.1
|
||||
#
|
||||
## make sure your `go env GOPATH` is in the `$PATH`
|
||||
## Install:
|
||||
## + latest buf (v1.0.0-rc11 or later)
|
||||
## + protobuf v3
|
||||
#
|
||||
## All protoc dependencies must be installed not in the module scope
|
||||
## currently we must use grpc-gateway v1
|
||||
# cd ~
|
||||
# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
# go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
# go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0
|
||||
# go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
|
||||
# go get github.com/regen-network/cosmos-proto@latest # doesn't work in install mode
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
protoc_install_gocosmos() {
|
||||
echo "Installing protobuf gocosmos plugin"
|
||||
# we should use go install, but regen-network/cosmos-proto contains
|
||||
# replace directives. It must not contain directives that would cause
|
||||
# it to be interpreted differently than if it were the main module.
|
||||
# So the command below issues a warning and we are muting it for now.
|
||||
#
|
||||
# Installing plugins must be done outside of the module
|
||||
(go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v0.3.1 2> /dev/null)
|
||||
}
|
||||
|
||||
protoc_install_gocosmos
|
||||
|
||||
echo "Generating gogo proto code"
|
||||
cd proto
|
||||
proto_dirs=$(find ./cosmos -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
|
||||
|
|
|
@ -556,6 +556,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
mux.Handle("GET", pattern_Query_SpendableBalances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
|
@ -563,6 +565,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_SpendableBalances_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
|
|
Loading…
Reference in New Issue