envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
25.13k stars 4.82k forks source link

bazel cquery fails with missing BUILD file errors #16686

Open jpeach opened 3 years ago

jpeach commented 3 years ago

Title:

bazel cquery fails with missing BUILD file errors

Description:

Any invocation of bazel cquery fails because bazel believes there are missing BUILD files.

Repro steps:

y$ bazel cquery 'kind("cc_library", //...)'
INFO: Invocation ID: 8cfd8140-996b-4f48-956d-1f3af9a936bc
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo.bzl:492:10: Bazel 4.1.0 is used in rbe_ubuntu_clang.
ERROR: /home/jpeach/upstream/envoy/bazel/toolchains/BUILD:3:9: in exec_properties attribute of platform rule //bazel/toolchains:rbe_ubuntu_clang_platform: Platform specifies remote_execution_properties but its parent specifies exec_properties. Prefer exec_properties over the deprecated remote_execution_properties.
ERROR: Analysis of target '//bazel/toolchains:rbe_ubuntu_clang_platform' failed; build aborted: Analysis of target '//bazel/toolchains:rbe_ubuntu_clang_platform' failed
INFO: Elapsed time: 1.449s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (574 packages loaded, 64 targets configured)

Config:

$ bazel version
Bazelisk version: v1.8.1
Build label: 4.1.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri May 21 11:11:34 2021 (1621595494)
Build timestamp: 1621595494
Build timestamp as int: 1621595494
yanavlasov commented 3 years ago

It does not look like BUILD files are missing. It looks like new bazel thinks our toolchain configuration is deprecated. Which it is. New toolchain config was reverted during 1.19 release and I still need to put it back. It may resolve this issue. Do you know if the query works with 3.7.2?

jpeach commented 3 years ago

It seems to be the same behavior with bazel 3.7.2:

jpeach@greenling:~/upstream/envoy$ echo 3.7.2 > .bazelversion
jpeach@greenling:~/upstream/envoy$ bazel version
Bazelisk version: v1.8.1
Starting local Bazel server and connecting to it...
Build label: 3.7.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 17 16:57:23 2020 (1608224243)
Build timestamp: 1608224243
Build timestamp as int: 1608224243
jpeach@greenling:~/upstream/envoy$ bazel cquery 'kind("cc_library", //...)'
INFO: Invocation ID: 24e50cdf-9909-4670-a44a-63a82cf9f348
DEBUG: /home/jpeach/.cache/bazel/_bazel_jpeach/af5610e61ef13740f13f753f9b95f927/external/bazel_toolchains/rules/rbe_repo.bzl:492:10: Bazel 3.7.2 is used in rbe_ubuntu_clang.
ERROR: /home/jpeach/upstream/envoy/generated_api_shadow/envoy/admin/v2alpha/BUILD:7:18: no such package 'envoy/service/tap/v2alpha': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /home/jpeach/upstream/envoy/envoy/service/tap/v2alpha and referenced by '//generated_api_shadow/envoy/admin/v2alpha:pkg'
ERROR: Analysis of target '//generated_api_shadow/envoy/admin/v2alpha:pkg_cc_proto_cc_proto' failed; build aborted: Analysis failed
INFO: Elapsed time: 13.462s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (968 packages loaded, 1318 targets configured)
    Fetching @remotejdk11_linux; Restarting.
github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

jpeach commented 3 years ago

not stale :)