bazel-contrib / target-determinator

Determines which Bazel targets were affected between two git commits.
Apache License 2.0
144 stars 22 forks source link

In Bazel 7 diffs involving 3rd party deps seem to be ignored #81

Closed mark-thm closed 3 months ago

mark-thm commented 9 months ago

I'm running Bazel 7 and rules_python 0.27.1 (via bzlmod, using rules_python's pip management).

Given a basic py_library that depends on a requirement, updating the underlying requirement's version no longer seems to cause target-determinator to indicate my target has changed.

purkhusid commented 9 months ago

I also encountered this when updating some oci_image targets in our WORKSPACE file.

mark-thm commented 9 months ago

Good call -- can also confirm I'm seeing this for oci_pull defined repos in MODULE.bazel.

illicitonion commented 9 months ago

I've been debugging this, https://github.com/bazelbuild/bazel/issues/20757 is what I've worked out so far.

illicitonion commented 9 months ago

I can't repro this with oci_pull - if you don't think the above linked issue encapsulates what you're seeing, can you post a minimal repro repo somewhere I can debug in?

mark-thm commented 5 months ago

Here's a minimal repro on Bazel 7.1.1: https://github.com/mark-thm/td-81

Running target-determinator HEAD~1 with t-d 0.26.0 produces no changed targets -- the hash for the image base was changed, though.

mark-thm commented 5 months ago

Running bazel cquery 'deps(//:test)' seems to produce different results between the commits:

5101a964cf6257720ac70242d03349b328d7585d (first commit)

//:test (7170974)
@ubuntu//:ubuntu (7170974)
@bazel_tools//tools/sh:toolchain_type (7170974)
@rules_oci//oci/private:image.sh (null)
@@aspect_bazel_lib~//lib:jq_toolchain_type (7170974)
@@bazel_tools~sh_configure_extension~local_config_sh//:local_sh (7170974)
@@rules_oci~~oci~oci_crane_darwin_arm64//:crane_toolchain (7170974)
@platforms//os:windows (bcfe008)
@rules_oci//oci:registry_toolchain_type (7170974)
@rules_oci//oci:crane_toolchain_type (7170974)
@@rules_oci~~oci~oci_crane_darwin_arm64//:registry_toolchain (7170974)
@@aspect_bazel_lib~~ext~jq_darwin_arm64//:jq_toolchain (7170974)
@local_config_platform//:host (bcfe008)
@rules_oci//oci/private:empty.tar (null)
@platforms//os:os (bcfe008)
@platforms//os:osx (bcfe008)
@@rules_oci~~oci~oci_crane_darwin_arm64//:crane (null)
@@aspect_bazel_lib~~ext~jq_darwin_arm64//:jq (null)
@@rules_oci~~oci~oci_crane_darwin_arm64//:launcher.sh (null)
@platforms//cpu:aarch64 (bcfe008)
@@rules_oci~~oci~ubuntu_single//:ubuntu_single (7170974)
@platforms//cpu:cpu (bcfe008)
@@aspect_bazel_lib~//lib:copy_to_directory_toolchain_type (7170974)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/52882761a72a60649edff9a2478835325d084fb640ea32a975e29e12a012025f (null)
@@rules_oci~~oci~ubuntu_single//:oci-layout (null)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/2af372c1e2645779643284c7dc38775e3dbbc417b2d784a27c5a9eb784014fb8 (null)
@@rules_oci~~oci~ubuntu_single//:index.json (null)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/a8b1c5f80c2d2a757adc963e3fe2dad0b4d229f83df3349fbb70e4d12dd48822 (null)
@@aspect_bazel_lib~~ext~copy_to_directory_darwin_arm64//:copy_to_directory_toolchain (7170974)
@@aspect_bazel_lib~~ext~copy_to_directory_darwin_arm64//:copy_to_directory (null)

2342255c560181e19246b2f7046542970a486430 (second commit)

//:test (7170974)
@ubuntu//:ubuntu (7170974)
@bazel_tools//tools/sh:toolchain_type (7170974)
@rules_oci//oci/private:image.sh (null)
@@aspect_bazel_lib~//lib:jq_toolchain_type (7170974)
@@bazel_tools~sh_configure_extension~local_config_sh//:local_sh (7170974)
@@rules_oci~~oci~oci_crane_darwin_arm64//:crane_toolchain (7170974)
@platforms//os:windows (bcfe008)
@rules_oci//oci:registry_toolchain_type (7170974)
@rules_oci//oci:crane_toolchain_type (7170974)
@@rules_oci~~oci~oci_crane_darwin_arm64//:registry_toolchain (7170974)
@@aspect_bazel_lib~~ext~jq_darwin_arm64//:jq_toolchain (7170974)
@local_config_platform//:host (bcfe008)
@rules_oci//oci/private:empty.tar (null)
@platforms//os:os (bcfe008)
@platforms//os:osx (bcfe008)
@@rules_oci~~oci~oci_crane_darwin_arm64//:crane (null)
@@aspect_bazel_lib~~ext~jq_darwin_arm64//:jq (null)
@@rules_oci~~oci~oci_crane_darwin_arm64//:launcher.sh (null)
@platforms//cpu:aarch64 (bcfe008)
@@rules_oci~~oci~ubuntu_single//:ubuntu_single (7170974)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/bf3dc08bfed031182827888bb15977e316ad797ee2ccb63b4c7a57fdfe7eb31d (null)
@platforms//cpu:cpu (bcfe008)
@@aspect_bazel_lib~//lib:copy_to_directory_toolchain_type (7170974)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/49b384cc7b4aa0dfd16ff7817ad0ea04f1d0a8072e62114efcd99119f8ceb9ed (null)
@@rules_oci~~oci~ubuntu_single//:oci-layout (null)
@@rules_oci~~oci~ubuntu_single//:index.json (null)
@@aspect_bazel_lib~~ext~copy_to_directory_darwin_arm64//:copy_to_directory_toolchain (7170974)
@@rules_oci~~oci~ubuntu_single//:blobs/sha256/d21429c4635332e96a4baae3169e3f02ac8e24e6ae3d89a86002d49a1259a4f7 (null)
@@aspect_bazel_lib~~ext~copy_to_directory_darwin_arm64//:copy_to_directory (null)

diff

21a22
> @@rules_oci~~oci~ubuntu_single//:blobs/sha256/bf3dc08bfed031182827888bb15977e316ad797ee2ccb63b4c7a57fdfe7eb31d (null)
24c25
< @@rules_oci~~oci~ubuntu_single//:blobs/sha256/52882761a72a60649edff9a2478835325d084fb640ea32a975e29e12a012025f (null)
---
> @@rules_oci~~oci~ubuntu_single//:blobs/sha256/49b384cc7b4aa0dfd16ff7817ad0ea04f1d0a8072e62114efcd99119f8ceb9ed (null)
26d26
< @@rules_oci~~oci~ubuntu_single//:blobs/sha256/2af372c1e2645779643284c7dc38775e3dbbc417b2d784a27c5a9eb784014fb8 (null)
28d27
< @@rules_oci~~oci~ubuntu_single//:blobs/sha256/a8b1c5f80c2d2a757adc963e3fe2dad0b4d229f83df3349fbb70e4d12dd48822 (null)
29a29
> @@rules_oci~~oci~ubuntu_single//:blobs/sha256/d21429c4635332e96a4baae3169e3f02ac8e24e6ae3d89a86002d49a1259a4f7 (null)
illicitonion commented 5 months ago

This will be fixed in Bazel 7.2.0 by https://github.com/bazelbuild/bazel/pull/21939 - I've just verified with your repro :)

mark-thm commented 5 months ago

Thanks! Sorry it took so long to put something together.

mark-thm commented 3 months ago

Confirming this appears to be fixed in 7.2.0. Thanks!