Skip to content

build: cleaning up visibility rules#20592

Merged
alyssawilk merged 4 commits intoenvoyproxy:mainfrom
alyssawilk:other_build
Mar 31, 2022
Merged

build: cleaning up visibility rules#20592
alyssawilk merged 4 commits intoenvoyproxy:mainfrom
alyssawilk:other_build

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk commented Mar 30, 2022

Removing unnecessary public visibility from extensions.
Changing the visibility rules of extensions to be visible from contrib and examples. We do this for the specific extensions which need it, but I'm comfortable leaving it as blanket visibility and it will avoid churn as other deps are needed.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

want to land this before the other one :-P

@alyssawilk
Copy link
Copy Markdown
Contributor Author

/wait want a working build and thent o land this

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk changed the title build: fixing visibility rules build: cleaning up visibility rules Mar 30, 2022
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@phlax
Copy link
Copy Markdown
Member

phlax commented Mar 31, 2022

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #20592 (comment) was created by @phlax.

see: more, trace.

Copy link
Copy Markdown
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @alyssawilk

@alyssawilk alyssawilk merged commit 5642536 into envoyproxy:main Mar 31, 2022
"-DWASM_USE_CEL_PARSER",
],
}),
visibility = ["//visibility:public"],
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.

This should be reverted to public, since Wasm C++ extensions depend on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think this should be public, as we don't want Envoy core code depending on it. The visibility rules are to prevent dependency leakage upstream (see the associaed issue)

source/extensions/extensions_build_config.bzl allows you to define overrides for downstream visibility changes, so if we're having trouble with import we can override there. Alternately if we want a rule for WASM_VISIBILTY which in envoy defaults to EXTENSION_VISIBILITY but for istio/import can be more broad I'd be happy to add that.

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.

This is a different situation than extensions. Null VM binaries are linked against the headers @proxy_wasm_cpp_host//:null_lib which are implemented by this library. So to run tests that are not associated with any extension, we need some runtime. Are you suggesting to create an extension for this target that can be exposed to unit tests in downstream repos?

Copy link
Copy Markdown
Contributor Author

@alyssawilk alyssawilk Apr 6, 2022

Choose a reason for hiding this comment

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

Where are those binaries linked? I'm still not understanding why the default visibility rules cant' be changed for the use case which is encountering the problem.
cc @phlax @lizan @mattklein123

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.

The intent here is to actually encourage using Wasm C++ ABI via @proxy_wasm_cpp_host, so hiding the implementation seems like going against it. If you insist, we can add a variable to control visibility, but it seems it's the easiest to just make Wasm library public.

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.

Sample binary https://github.com/istio/proxy/blob/master/extensions/common/BUILD#L95. It's a test for a library in a Wasm extension.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I will admit that I don't fully understand the moving pieces here, but are you saying that this is not really an extension but basically an export library that must be linked into null-VM extensions? How would one then link the null VM extension into Envoy itself? Via the normal mechanisms?

Is there some way we could make it easy to just expose this export library (and I would rename to wasm_export_lib or something to make it clear) to consuming extensions? I'm not sure what is possible with bazel.

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.

Linking the Wasm extension using envoy_extension_cc_test into tests solves the issue. Sorry for the noise. I was confused myself since these tests don't really import anything Envoy except proxy-wasm headers, so it's a bit awkward but not a big deal.

ravenblackx pushed a commit to ravenblackx/envoy that referenced this pull request Jun 8, 2022
Removing unnecessary public visibility from extensions.
Changing the visibility rules of extensions to be visible from contrib and examples. We do this for the specific extensions which need it, but I'm comfortable leaving it as blanket visibility and it will avoid churn as other deps are needed.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk deleted the other_build branch August 4, 2022 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants