Skip to content

Bazel green build CI job now fails persistently due to rules_java versioning #1625

Closed
@mbland

Description

@mbland

All CI jobs except "Bazel green head" pass for my PRs working towards #1482 with the following error:

bazel --nosystem_rc --nohome_rc info
ERROR: Failed to load Starlark extension '@@rules_java//toolchains:toolchain_utils.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
 - @@rules_java
This could either mean you have to add the '@@rules_java' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: cannot load build configuration key because of this cycle
Traceback (most recent call last):
  File "bazelci.py", line 4588, in <module>
    sys.exit(main())
  File "bazelci.py", line 4556, in main
    execute_commands(
  File "bazelci.py", line 1321, in execute_commands
    bazel_version = print_bazel_version_info(bazel_binary, platform)
  File "bazelci.py", line 1623, in print_bazel_version_info
    execute_command(
  File "bazelci.py", line 2750, in execute_command
    return subprocess.run(
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bazel', '--nosystem_rc', '--nohome_rc', 'info']' returned non-zero exit status 2.

After reviewing my notes from cd22d88, under Bump to rules_java 7.9.0 for Bazel 7 compatibility, it seems like our WORKSPACE builds can't be compatible with Bazel 6/7 and Bazel 8 at the same time. The basic issue is that for rules_java > 7.9.0, the WORKSPACE prefix in Bazel 6/7 causes Java toolchains to register under a different type than what the rules are expecting later. This issue doesn't affect Bzlmod builds.

Would it be possible to disable the "Bazel green head" builds until the Bzlmod compatibility lands, and then reenable that build with Bzlmod enabled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions