Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c0c4a81
Adjust go_package of lib/prehog Go protobufs
ravicious Jan 10, 2023
700b0a8
Adjust go_package of lib/teleterm Go protobufs
ravicious Jan 10, 2023
53db96e
Use single buf.gen.yaml to generate JS protos
ravicious Jan 11, 2023
b2af272
Make web/packages/teleterm use protobufs from gen-proto-js
ravicious Jan 27, 2023
adc3c18
Move prehog & teleterm protos into proto/teleport/lib
ravicious Jan 30, 2023
daa7a04
Generate JS protos to gen/proto/js
ravicious Jan 30, 2023
90aa291
Merge branch 'master' into ravicious/grpc-js-refactor
ravicious Feb 1, 2023
fa5af5c
Move lib/teleterm Go protobufs to gen/proto/go
ravicious Feb 1, 2023
7e62849
Move lib/prehog Go protobufs to gen/proto/go
ravicious Feb 1, 2023
1a19f16
Rename lib/teleterm proto package
ravicious Feb 1, 2023
255dd2d
Re-enable linter rules for teleterm & prehog
ravicious Feb 1, 2023
bc7f76d
Update prehogv1 path in usagereporter_test.go
ravicious Feb 1, 2023
54a8817
Use except instead of ignore_only to allow Google API-style responses
ravicious Feb 2, 2023
c325adb
Add UNARY_RPC to api/proto & proto
ravicious Feb 2, 2023
f7f7940
Merge branch 'master' into ravicious/grpc-js-refactor
ravicious Feb 2, 2023
d6d1d53
Ignore gen/ when running addlicense
ravicious Feb 2, 2023
e1b3a06
buf-js.gen.yaml: Remove comment about lack of go_package for JS
ravicious Feb 2, 2023
a45c531
Move prehog protos to proto/prehog/v1alpha
ravicious Feb 3, 2023
5eb1265
Adjust prehog's go_package to match proto package
ravicious Feb 3, 2023
147d1b2
Merge branch 'master' into ravicious/grpc-js-refactor
ravicious Feb 3, 2023
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
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,9 @@ ADDLICENSE_ARGS := -c 'Gravitational, Inc' -l apache \
-ignore 'api/version.go' \
-ignore 'docs/pages/includes/**/*.go' \
-ignore 'e/**' \
-ignore 'gen/**' \
-ignore 'gitref.go' \
-ignore 'lib/srv/desktop/rdp/rdpclient/target/**' \
-ignore 'lib/teleterm/api/protogen/**' \
-ignore 'lib/prehog/gen/**' \
-ignore 'lib/prehog/gen-js/**' \
-ignore 'lib/web/build/**' \
-ignore 'version.go' \
-ignore 'webassets/**' \
Expand Down
15 changes: 15 additions & 0 deletions api/proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ lint:
use:
- DEFAULT
- PACKAGE_NO_IMPORT_CYCLE
- UNARY_RPC
# Top-level types require comments.
- COMMENT_ENUM
- COMMENT_MESSAGE
Expand All @@ -33,6 +34,20 @@ lint:
PACKAGE_VERSION_SUFFIX:
- teleport/legacy/client/proto/joinservice.proto
- teleport/legacy/types/webauthn/webauthn.proto
# Allow only certain services to use streaming RPCs.
#
# We should avoid streaming RPCs until we have a compelling reason to use them (e.g. the
# implementation needs 1-N messages or the server cannot dial directly to the client).
#
# Check out the links below. If you still have questions or doubts, reach out to @codingllama.
#
# https://docs.buf.build/lint/rules#unary_rpc
# https://github.com/gravitational/teleport/pull/16043#issuecomment-1235728212
# https://github.com/twitchtv/twirp/issues/70#issuecomment-470367807
UNARY_RPC:
- teleport/devicetrust/v1/devicetrust_service.proto
- teleport/legacy/client/proto/joinservice.proto
- teleport/proxy/v1/proxy_service.proto
Comment thread
codingllama marked this conversation as resolved.
breaking:
use:
- FILE
8 changes: 8 additions & 0 deletions buf-connect-go.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: go
path: lib/prehog/bin/protoc-gen-go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but we should consolidate so we don't have tooling versions tracked by go.mod and tooling versions tracked via buildbox.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea of just needing go to generate all the RPCs, but as that's no longer a possibility with grpc_node_plugin anyway, I'm 👍

out: .
- name: connect-go
path: lib/prehog/bin/protoc-gen-connect-go
out: .
18 changes: 18 additions & 0 deletions buf-js.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v1
plugins:
# https://github.com/protocolbuffers/protobuf/tree/v3.20.1/js
- name: js
out: gen/proto/js
opt:
- import_style=commonjs,binary

# https://github.com/grpc/grpc-node/tree/grpc-tools%401.11.2/packages/grpc-tools/
- name: grpc
out: gen/proto/js
opt: grpc_js
path: grpc_tools_node_protoc_plugin

# https://github.com/agreatfool/grpc_tools_node_protoc_ts/tree/v5.0.1
- name: ts
out: gen/proto/js
opt: "service=grpc-node"
2 changes: 0 additions & 2 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
version: v1
directories:
- api/proto
- lib/prehog/proto
- lib/teleterm/api/proto
- proto
26 changes: 13 additions & 13 deletions build.assets/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ main() {
# Generated protos are written to
# <teleport-root>/github.com/gravitational/teleport/..., so we copy them to
# the correct relative path.
trap 'rm -fr github.com' EXIT # don't leave github.com/ behind
# cleanup gen/proto folders
rm -fr api/gen/proto gen/proto lib/teleterm/api/protogen lib/prehog/gen lib/prehog/gen-js
trap 'rm -fr github.com' EXIT # don't leave github.com/ behind
rm -fr api/gen/proto gen/proto # cleanup gen/proto folders
Comment thread
codingllama marked this conversation as resolved.

# Generate Gogo protos.
buf generate --template=buf-gogo.gen.yaml api/proto
Expand All @@ -24,16 +23,17 @@ main() {
--path=api/proto/teleport/devicetrust/ \
--path=api/proto/teleport/loginrule/ \
--path=api/proto/teleport/proxy/ \
--path=proto/teleport/lib/multiplexer/
buf generate --template=lib/prehog/buf.gen.yaml lib/prehog/proto

# Generate lib/teleterm & JS protos.
# TODO(ravicious): Refactor generating JS protos to follow the approach from above, that is have a
# separate call to generate Go protos and another for JS protos instead of having
# teleterm-specific buf.gen.yaml files.
# https://github.com/gravitational/teleport/pull/19774#discussion_r1061524458
buf generate --template=lib/prehog/buf-teleterm.gen.yaml lib/prehog/proto
buf generate --template=lib/teleterm/buf.gen.yaml lib/teleterm/api/proto
--path=proto/teleport/lib/multiplexer/ \
--path=proto/teleport/lib/teleterm/

# Generate connect-go protos.
buf generate --template=buf-connect-go.gen.yaml \
--path=proto/prehog/

# Generate JS protos.
buf generate --template=buf-js.gen.yaml \
--path=proto/prehog/ \
--path=proto/teleport/lib/teleterm/

cp -r github.com/gravitational/teleport/* .
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading