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

[Bazel CI] Error no native function or rules 'sh_test' #2299

Closed
sgowroji opened this issue Oct 14, 2024 · 5 comments · Fixed by #2305
Closed

[Bazel CI] Error no native function or rules 'sh_test' #2299

sgowroji opened this issue Oct 14, 2024 · 5 comments · Fixed by #2305
Assignees

Comments

@sgowroji
Copy link
Member

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4198#01928938-25f1-42af-ad77-b740b840f290

Platform: MacOS

Logs:

 ERROR: Traceback (most recent call last):
	File "/Users/buildkite/builds/bk-macos-pln3-pwxc/bazel-org-repo-root/rules_python/tests/integration/BUILD.bazel", line 90, column 30, in <toplevel>
		rules_python_integration_test(
	File "/Users/buildkite/builds/bk-macos-pln3-pwxc/bazel-org-repo-root/rules_python/tests/integration/integration_test.bzl", line 109, column 31, in rules_python_integration_test
		bazel_integration_test(
	File "/private/var/tmp/_bazel_buildkite/023fa58f497dd9f18a2fd23677a71d45/external/rules_bazel_integration_test+/bazel_integration_test/private/bazel_integration_test.bzl", line 164, column 11, in bazel_integration_test
		native.sh_test(
Error: no native function or rule 'sh_test'
Available attributes: action_listener, alias, available_xcodes, cc_binary, cc_import, cc_libc_top_alias, cc_library, cc_proto_library, cc_shared_library, cc_static_library, cc_test, cc_toolchain, cc_toolchain_alias, cc_toolchain_suite, config_feature_flag, config_setting, constraint_setting, constraint_value, environment, existing_rule, existing_rules, exports_files, extra_action, fdo_prefetch_hints, fdo_profile, filegroup, genquery, genrule, glob, java_binary, java_import, java_library, java_lite_proto_library, java_package_configuration, java_plugin, java_plugins_flag_alias, java_proto_library, java_runtime, java_test, java_toolchain, label_flag, label_setting, legacy_globals, memprof_profile, module_name, module_version, objc_import, objc_library, package, package_group, package_name, package_relative_label, platform, propeller_optimize, proto_lang_toolchain, proto_library, repo_name, repository_name, starlark_doc_extract, subpackages, test_suite, toolchain, toolchain_type, xcode_config, xcode_config_alias, xcode_version

Culprit:

Steps:

git clone https://github.com/bazelbuild/rules_python
git reset 0e604b06ae4c29c9d386677d3ac57ffe4012e3d7  --hard
export USE_BAZEL_VERSION=00fdb673ba8276e83f1c821a7f93aab7038377e2
bazel build ... @rules_python//examples/wheel/... 

CC Greenteam @meteorcloudy

@aignas aignas added this to the v1.0.0 milestone Oct 15, 2024
@aignas
Copy link
Collaborator

aignas commented Oct 15, 2024

FYI, the tests are failing with

Error in expand_location: file '@@rules_shell//shell/private:sh_executable.bzl' cannot use private API

At least for older bazel versions. Could you please take a look?

@aignas aignas removed this from the v1.0.0 milestone Oct 15, 2024
@rickeylev
Copy link
Collaborator

If the plan is for it to require a minimum bazel version, then let us know so we can try and apply appropriate workarounds, if necessary (IMHO: this is a detail rules_shell should take care of).

Also, is there a tracking bug for the migration? It would just be handy to have if we need to refer to it or report bugs we find.

@meteorcloudy
Copy link
Member

rules_shell 0.2.0 already automatically fallback to native rules if available, see bazelbuild/rules_shell#10

I think the correct way is to load rules_shell everywhere like protobuf did: protocolbuffers/protobuf@8ec13ed

/cc @comius @fmeum

github-merge-queue bot pushed a commit that referenced this issue Oct 16, 2024
Summary:
- move bazelversion sh_test to //tests
- add rules_shell dev dependency
- use sh_test for the sh_py_run_test
- use rules_shell in examples/bzlmod
- use rules_shell in multi_python_versions example

Fixes #2299.
@sgowroji
Copy link
Member Author

Rules_python CI is still failing https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4208#01929dce-7b67-4627-896b-5289323e35b1  CC @rickeylev . Can you please take a look. Thanks!

@rickeylev
Copy link
Collaborator

That failure appears to be from a dependency: rules_bazel_integration_test (https://github.com/bazel-contrib/rules_bazel_integration_test)

/external/rules_bazel_integration_test+/bazel_integration_test/private/bazel_integration_test.bzl

It'll require a fix in that project.

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 a pull request may close this issue.

4 participants