Skip to content
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
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -869,11 +869,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
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
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

# 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