bazelbuild / bazelbuild/bazel

Nondeterministic errors with MODULE.bazel flag_alias()

Open
#28,836 0 comments 0 reactions 2 assignees Assigned to @gregestren View on GitHub
P1 team-Configurability type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Context: https://github.com/bazel-contrib/rules_python/pull/3450#issuecomment-3974932245.

- That PR adds `flag_alias` `MODULE.bazel` registrations for `rules_python` flags
- `rules_python` CI sometimes fails on `no such package '@@rules_python//python/config_settings': The repository '@@rules_python' could not be resolved`
- It seems to only apply to rules that call transitions (building a straight `py_binary` never showed issues).
- I think switching from `USE_BAZEL_VESION=last_rc` (`9.0.0rc6`) to `USE_BAZEL_VERSION=last_green` fixes it.
- But the error doesn't consistently happen.

### Which category does this issue belong to?

Configurability

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

1. Clone `rules_python` at commit https://github.com/bazel-contrib/rules_python/commit/c91d9f026c8d10b1807a3ad5cc6dc2027a65e98e
1. Run `$ USE_BAZEL_VERSION=9.0.0rc6; bazelisk clean && bazelisk build --nobuild //tests/py_zipapp:system_python_zipapp`. This fails many times in a row, then succeeds many times in a row
2. Run `$ USE_BAZEL_VERSION=last_green; bazelisk clean && bazelisk build --nobuild //tests/py_zipapp:system_python_zipapp`. This seems to always succeed.

A custom bazel built at https://github.com/bazelbuild/bazel/tree/release-9.0.1 with https://github.com/bazelbuild/bazel/pull/28835 cherrypicked non-determinsitcally fails with I think a different (and smaller) error:

```
py_zipapp_rule.bzl:234:32: Starlark flag '//python/config_settings:build_python_zip' and its alias '//command_line_option:build_python_zip' have different values: 'false' and 'false'
```

I remember seeing that last error and I think someone fixed it, but I can't remember where...

### Which operating system are you running Bazel on?

Linux

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text
git@github.com:bazel-contrib/rules_python.git
c91d9f026c8d10b1807a3ad5cc6dc2027a65e98e
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.