bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.07k stars 4.04k forks source link

Wrong Bazel Execution Platform Selection After Upgrading to Bazel 7 #23242

Open talsharon48 opened 2 months ago

talsharon48 commented 2 months ago

Description of the bug:

I'm upgrading from Bazel 6.5.0 to 7.2.1 and encountering issues with execution platform selection.

I have three different execution platforms, each with a unique constraint_value under the same constraint_setting. To ensure my target uses the correct execution platform, I utilize the exec_compatible_with attribute to specify the constraint_value that matches only one platform.

In Bazel 6.5.0, everything worked as expected; the target was executed on the desired platform. I confirmed this by running bazel test -s //target and saw that the "Testing" action was correctly executed on the appropriate platform:

SUBCOMMAND: # //target [action 'Testing //target, configuration: ....., execution platform: //path/to/platform/target].

However, after upgrading to Bazel 7.2.1, I've noticed that only the "Compiling" action is using the correct execution platform, while other actions like "Linking" and "Testing" are selecting the wrong platform. This incorrect platform doesn't have the required constraint_value, and it seems to be the first platform listed in the --extra_execution_platforms in my .bazelrc. This is causing my tests to fail.

Which category does this issue belong to?

Remote Execution

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

Upgrading from Bazel 6.5.0 to 7.2.1

Which operating system are you running Bazel on?

Rocky 9.1

What is the output of bazel info release?

release 7.2.1

fmeum commented 2 months ago

This looks like a duplicate of https://github.com/bazelbuild/bazel/issues/23202

katre commented 1 week ago

@talsharon48 Do you have a reproduction I can look at? I agree with @fmeum that this looks very similar to #23202 .