-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
api: shadowing for API protos. #9429
Conversation
This is a sketch for what the shadow protos would look like. I think I can get them working end-to-end with only a small amount of additional work on import paths and BUILD files. At this point, given that it sort-of-works, I'm interested in hearing from @lizan how hard it might be to turn this into some sort of aspect rule based approach that hides the shadows in the Bazel cache. |
This is intended to simplify the internal handling of deprecations during API boosting. See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0. Risk level: Low Testing: Additional API test and protoxform golden test. Part of envoyproxy#8082 Signed-off-by: Harvey Tuch <htuch@google.com>
cc84c19
to
4ff07db
Compare
@lizan @mattklein123 this is now ready for review and is the plan-of-record for 1.13.0 + v3. |
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks this makes sense to me. I have 2 small comments and also one general question: I'm a little fearful that this is going to cause a bunch of pain for consuming projects that consume Envoy as a submodule. Do you have any intuition of what this will look like? Do you think we should run the tooling in the envoy-filter-example repo to expose issues like this? This should probably done as a P1 ASAP thing? WDYT?
api_shadow/BUILD
Outdated
@@ -0,0 +1,157 @@ | |||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe put this somewhere else that is not top level so that people don't see it, ignore the README, and get pretty confused? My first thought was a top level generated/
directory, but I think we have scripts that put stuff in a directory by that name so that might get confusing. Also, it's still top level. Maybe somewhere under bazel/
as it is a baked in part of our build that should eventually just go away? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about prebuillt/api_shadow
, internal/api_shadow
, vendored/api_shadow
? Prefer not under bazel/
, as this doesn't technically relate to Bazel infra (but it is build related).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, maybe generated_api
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like prebuilt/api_shadow
but I don't feel that strongly about it. (2nd place would be vendored/
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it in generated_api_shadow
; it's only 3 lines to change it to whatever folks want, so if @lizan has any strong preferences, we can do that.
@mattklein123 re: submodules, I think this should be largely transparent. As long as folks are using |
Signed-off-by: Harvey Tuch <htuch@google.com>
.gitattributes
Outdated
@@ -1,6 +1,8 @@ | |||
/docs/root/intro/version_history.rst merge=union | |||
*.generated.pb_text linguist-generated=true | |||
*.generated.pb_text -diff -merge | |||
/api_shadow/envoy/** linguist-generated=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update this?
include/envoy/config/BUILD
Outdated
@@ -44,7 +44,7 @@ envoy_cc_library( | |||
hdrs = ["subscription_factory.h"], | |||
deps = [ | |||
":subscription_interface", | |||
"@envoy_api//envoy/api/v2/core:pkg_cc_proto", | |||
"@envoy_api_shadow//envoy/api/v2/core:pkg_cc_proto", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we switch the bind, (i.e. use @envoy_api
for shadow)? I think that makes less breaking for BUILD files under include/
and source/
, and less breaking for consuming project, as @mattklein123 pointed out.
Otherwise this will easily cause ODR violation when some consuming project trying to link @envoy_api//envoy/api/v2/core:pkg_cc_proto
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have done this, but it comes with tradeoffs. While most of the source now deals with @envoy_api
, we have to switch all developer tools to an alias for the real artifacts, @envoy_api_canonical
(lest we have some weird dependence of generating tools on generated artifacts). Then we need to symlink across Bazel rules. It works, PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it comes with tradeoffs but I prefer this way to be less breaking for consuming projects, as well as less breaking when we merge envoy_api_canonical
with envoy_api
.
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@lizan Windows breaks due to the symlink, do you know if we can enable "developer mode" on CI to solve this? https://www.quora.com/How-does-Git-handle-symbolic-links-on-Windows |
Hmm, not sure how to do this, were we previously not using symlink? |
OK, will merge for now and we can sort out Windows next week. Thanks. |
api: shadowing for API protos. (envoyproxy#9429)
Signed-off-by: Harvey Tuch <htuch@google.com>
This is intended to simplify the internal handling of deprecations during API boosting. See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0. Risk level: Low Testing: Additional API test and protoxform golden test. Part of envoyproxy#8082 This should be unwound in the future with envoyproxy#9479 Signed-off-by: Harvey Tuch <htuch@google.com> Signed-off-by: Prakhar <prakhar_au@yahoo.com>
Signed-off-by: Harvey Tuch <htuch@google.com> Signed-off-by: Prakhar <prakhar_au@yahoo.com>
This is intended to simplify the internal handling of deprecations during API boosting.
See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit
Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0.
Risk level: Low
Testing: Additional API test and protoxform golden test.
Part of #8082
This should be unwound in the future with #9479
Signed-off-by: Harvey Tuch htuch@google.com