-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
Description
Title: bazel: build failure when using envoy as an external repository
Description:
When using envoy as an external repository such as in envoy-filter-example, building @envoy//source/... fails
It looks like crates_repository is somehow looking for the lockfiles in the root repository rather than within the @envoy repository. CC: @mathetake
Notably, building the main application (bazel build @envoy//source/exe:envoy) does not seem to fail.
Repro steps:
git clone https://github.com/envoyproxy/envoy-filter-example.git
cd envoy-filter-example
git submodule --update
sed -i 's/{ENVOY_SRCDIR}/envoy/' WORKSPACE
bazel build @envoy//source/...
The output is
IINFO: Repository dynamic_modules_rust_sdk_crate_index instantiated at:
/home/envoybuild/envoy-filter-example/WORKSPACE:30:25: in <toplevel>
/home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/envoy/bazel/dependency_imports.bzl:61:24: in envoy_dependency_imports
/home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/envoy/bazel/dependency_imports.bzl:212:22: in crates_repositories
Repository rule crates_repository defined at:
/home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/rules_rust/crate_universe/private/crates_repository.bzl:124:36: in <toplevel>
INFO: repository @@dynamic_modules_rust_sdk_crate_index' used the following cache hits instead of downloading the corresponding file.
* Hash '53418ae5457040e84009f7c69b070e1f12f10a9a3a3ef4f5d0829c66e5438ba1' for https://github.com/bazelbuild/rules_rust/releases/download/0.56.0/cargo-bazel-x86_64-unknown-linux-gnu
If the definition of 'repository @@dynamic_modules_rust_sdk_crate_index' was updated, verify that the hashes were also updated.
ERROR: /home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/rules_rust/crate_universe/private/generate_utils.bzl:335:36: An error occurred during the fetch of repository 'dynamic_modules_rust_sdk_crate_index':
Traceback (most recent call last):
File "/home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/rules_rust/crate_universe/private/crates_repository.bzl", line 34, column 30, in _crates_repository_impl
lockfiles = get_lockfiles(repository_ctx)
File "/home/envoybuild/.cache/bazel/_bazel_envoybuild/405525df6bbb4394babec7266af37f69/external/rules_rust/crate_universe/private/generate_utils.bzl", line 335, column 36, in get_lockfiles
cargo = repository_ctx.path(repository_ctx.attr.cargo_lockfile),
Error in path: Unable to load package for //source/extensions/dynamic_modules/sdk/rust:Cargo.lock: BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
- /home/envoybuild/envoy-filter-example/source/extensions/dynamic_modules/sdk/rust
WARNING: Target pattern parsing failed.
ERROR: Skipping '@envoy//source/...': error loading package under directory 'source': no such package '@@dynamic_modules_rust_sdk_crate_index//': Unable to load package for //source/extensions/dynamic_modules/sdk/rust:Cargo.lock: BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
- /home/envoybuild/envoy-filter-example/source/extensions/dynamic_modules/sdk/rust
ERROR: error loading package under directory 'source': no such package '@@dynamic_modules_rust_sdk_crate_index//': Unable to load package for //source/extensions/dynamic_modules/sdk/rust:Cargo.lock: BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
- /home/envoybuild/envoy-filter-example/source/extensions/dynamic_modules/sdk/rust
INFO: Elapsed time: 0.229s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
Reactions are currently unavailable