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

[release-3.5] MacOS support for scripts/genproto.sh #16760

Closed
4 tasks done
vivekpatani opened this issue Oct 13, 2023 · 7 comments · Fixed by #16883
Closed
4 tasks done

[release-3.5] MacOS support for scripts/genproto.sh #16760

vivekpatani opened this issue Oct 13, 2023 · 7 comments · Fixed by #16883
Assignees
Labels
area/tooling contribfest Issues for Contribfest workshop happening during KubeCon type/feature

Comments

@vivekpatani
Copy link
Contributor

vivekpatani commented Oct 13, 2023

Bug report criteria

What happened?

# first clone
git clone git@github.com:etcd-io/etcd.git

# enter directory
cd etcd

# switch to 3.5
git checkout release-3.5

# run genproto.sh from root, from a folder named etcd
./scripts/genproto.sh

#Error Trace
.
.
.
Running swagger & grpc_gateway proto generation...
grpc & swagger for: api/etcdserverpb/rpc.proto
% protoc -I. -I/Users/x/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.14.6/protoc-gen-grpc-gateway/../third_party/googleapis -I/Users/x/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/..:/Users/x/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/../protobuf -I/Users/x/junkyard/etcd/etcd/.. --grpc-gateway_out=logtostderr=true,paths=source_relative:. --swagger_out=logtostderr=true:./Documentation/dev-guide/apispec/swagger/. --plugin=/Users/x/go/bin/protoc-gen-swagger --plugin=/Users/x/go/bin/protoc-gen-grpc-gateway api/etcdserverpb/rpc.proto
% sed -i -E s#package etcdserverpb#package gw#g api/etcdserverpb/rpc.pb.gw.go
% sed -i -E s#import \(#import \("go.etcd.io/etcd/api/etcdserverpb"#g api/etcdserverpb/rpc.pb.gw.go
stderr: sed: 1: "s#import \(#import \("g ...": RE error: parentheses not balanced

What did you expect to happen?

Generate all the protos for etcd-3.5

How can we reproduce it (as minimally and precisely as possible)?

Stated above

Anything else we need to know?

No response

Etcd version (please run commands below)

$ etcd --version
3.5.9

$ etcdctl version
3.5.9

Etcd configuration (command line flags or environment variables)

paste your configuration here

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here

Relevant log output

Running swagger & grpc_gateway proto generation...
grpc & swagger for: api/etcdserverpb/rpc.proto
% protoc -I. -I/Users/x/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.14.6/protoc-gen-grpc-gateway/../third_party/googleapis -I/Users/x/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/..:/Users/x/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/../protobuf -I/Users/x/junkyard/etcd/etcd/.. --grpc-gateway_out=logtostderr=true,paths=source_relative:. --swagger_out=logtostderr=true:./Documentation/dev-guide/apispec/swagger/. --plugin=/Users/x/go/bin/protoc-gen-swagger --plugin=/Users/x/go/bin/protoc-gen-grpc-gateway api/etcdserverpb/rpc.proto
% sed -i -E s#package etcdserverpb#package gw#g api/etcdserverpb/rpc.pb.gw.go
% sed -i -E s#import \(#import \("go.etcd.io/etcd/api/etcdserverpb"#g api/etcdserverpb/rpc.pb.gw.go
stderr: sed: 1: "s#import \(#import \("g ...": RE error: parentheses not balanced
@vivekpatani vivekpatani changed the title scripts/geneproto.sh fails while local generation for etcd-3.5 release branch scripts/genproto.sh fails while local generation for etcd-3.5 release branch Oct 13, 2023
@fuweid
Copy link
Member

fuweid commented Oct 14, 2023

Did you run it in the linux ?

@chaochn47
Copy link
Member

chaochn47 commented Oct 16, 2023

How about exit the script if OS is not linux with error message that "please run it on linux"?

I bet not just @vivekpatani met this problem.

@vivekpatani
Copy link
Contributor Author

@fuweid it was a MacOS (Darwin) with Apple Silicon.

@chaochn47 thanks.

Okay, for anyone else runs into this, can try doing this until we have a proper workaround/error message:

  • If root folder name is not etcd, then git clone -b v3.5.0 https://github.com/etcd-io/etcd.git
  • Download the protoc 3.14.0 binary for darwin from here, and place it in $PATH
  • Replace all sed commands in scripts/genproto.sh with gsed, revert before moving forward. gsed = GNU Sed which is the one most linux variants use.

If this sounds like a solution, can make the scritps/genproto.sh a little more generic so you can build on Mac Apple Silicon as well. Can create PR if there's interest. Thank you for the help folks.

@jmhbnz
Copy link
Member

jmhbnz commented Oct 16, 2023

Thanks for sharing the workaround @vivekpatani. Just to make sure you're aware, as outlined in our CONTRIBUTING.md the only supported operating system for etcd development is linux currently.

However if you can do some cross platform testing between linux and darwin for this particular script and raise a pull request that sounds like a great step forward to removing friction for others in future. I'll certainly be happy to review it :)

@serathius serathius changed the title scripts/genproto.sh fails while local generation for etcd-3.5 release branch [release-3.5] MacOS support for scripts/genproto.sh Oct 27, 2023
@jmhbnz jmhbnz added the contribfest Issues for Contribfest workshop happening during KubeCon label Nov 7, 2023
@mjlshen
Copy link
Contributor

mjlshen commented Nov 7, 2023

I'm interested in working on this :D

@jmhbnz
Copy link
Member

jmhbnz commented Nov 7, 2023

Assigned, thanks @mjlshen! 🎉

@wenjiaswe
Copy link
Contributor

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tooling contribfest Issues for Contribfest workshop happening during KubeCon type/feature
Development

Successfully merging a pull request may close this issue.

7 participants