Skip to content
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

Unexpected buildifier error after upgrading to v6.0.0: Repository '@@bazel_features_globals' is not defined #212

Closed
johanbrandhorst opened this issue May 9, 2024 · 6 comments
Labels
bug Something isn't working P3 We're not considering to work on this, but happy to review a PR. (No assignee)

Comments

@johanbrandhorst
Copy link

Hi! My repository (grpc-gateway) auto-updated to v6.0.0 a while back but the CI buildifier job started failing, like so:

ERROR: error loading package '@@com_github_bazelbuild_buildtools//build_proto': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/defs.bzl:18:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/proto_toolchain.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain.bzl:20:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain_rule.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/bazel_features/features.bzl:3:6: Unable to find package for @@bazel_features_globals//:globals.bzl: The repository '@@bazel_features_globals' could not be resolved: Repository '@@bazel_features_globals' is not defined.
ERROR: /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_github_bazelbuild_buildtools/edit/BUILD.bazel:3:11: error loading package '@@com_github_bazelbuild_buildtools//build_proto': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/defs.bzl:18:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/proto_toolchain.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain.bzl:20:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain_rule.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/bazel_features/features.bzl:3:6: Unable to find package for @@bazel_features_globals//:globals.bzl: The repository '@@bazel_features_globals' could not be resolved: Repository '@@bazel_features_globals' is not defined. and referenced by '@@com_github_bazelbuild_buildtools//edit:edit'
ERROR: Analysis of target '//:buildifier' failed; build aborted: Analysis failed

Full log: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9012070457/job/24760663351?pr=4266.

I made the change to WORKSPACE recommended in the release notes but I don't know how to fix this error. Any help would be appreciated. Thanks!

@hgminh95
Copy link

load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

These 2 lines in WORKSPACE make it works for me.

@johanbrandhorst
Copy link
Author

johanbrandhorst commented May 14, 2024

That fixes the @@bazel_features_globals error, thank you, now I'm seeing

he repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined. and referenced by '@@io_bazel_rules_go//proto:protoc'

Any ideas for fixing this? Full logs: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9082583751/job/24959289319?pr=4266

@comius comius added bug Something isn't working P3 We're not considering to work on this, but happy to review a PR. (No assignee) labels May 15, 2024
@johanbrandhorst
Copy link
Author

Updating rules_proto and rules_go simultaneously seems to have worked! See changes in grpc-ecosystem/grpc-gateway#4356.

@johanbrandhorst
Copy link
Author

Spoke too soon, I'm seeing a different error now: The repository '@@rules_python_internal' could not be resolved. Full error text:

ERROR: error loading package '@@com_google_protobuf//': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_google_protobuf/protobuf.bzl:3:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/defs.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/py_binary.bzl:19:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_macro_bazel.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_rule_bazel.bzl:19:5: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_executable_bazel.bzl:34:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_internal.bzl:23:6: Unable to find package for @@rules_python_internal//:py_internal.bzl: The repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined.
ERROR: /__w/grpc-gateway/grpc-gateway/protoc-gen-openapiv2/options/BUILD.bazel:21:14: error loading package '@@com_google_protobuf//': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_google_protobuf/protobuf.bzl:3:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/defs.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/py_binary.bzl:19:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_macro_bazel.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_rule_bazel.bzl:19:5: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_executable_bazel.bzl:34:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_internal.bzl:23:6: Unable to find package for @@rules_python_internal//:py_internal.bzl: The repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined. and referenced by '//protoc-gen-openapiv2/options:options_proto'

Log: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9212749314/job/25345111154?pr=4356.

I'm reopening this issue rather than the rules_go issue since this seems related to the com_google_protobuf repository. Any help would be greatly appreciated.

@kczulko
Copy link

kczulko commented Sep 13, 2024

That fixes the @@bazel_features_globals error, thank you, now I'm seeing

he repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined. and referenced by '@@io_bazel_rules_go//proto:protoc'

Any ideas for fixing this? Full logs: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9082583751/job/24959289319?pr=4266

Had the same error. Fixed with:

load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

@johanbrandhorst
Copy link
Author

Thanks, that fixed it for me too! My final changes can be seen here: grpc-ecosystem/grpc-gateway@b1489cd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 We're not considering to work on this, but happy to review a PR. (No assignee)
Projects
None yet
Development

No branches or pull requests

4 participants