bazel-contrib / target-determinator

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

With Bazel 6 and bzlmod configured rules_python, target determinator complains of invalid characters #59

Closed mark-thm closed 1 year ago

mark-thm commented 1 year ago

When running with Bazel 6 and bzlmod configured rules_python, target-determinator complains of invalid characters in the repository name. rules_python when configured with bzlmod in Bazel 6 generates repository names of the form @rules_python~\d+\.\d+\.\d+\~pip~[user-defined-str].

An example of the error with minor redactions:

failed to process change: failed to load metadata at revision 'before' (sha: <sha>): failed to query at revision 'before' (sha: <sha>) in /runner/_work/repo/repo: failed to parse cquery result: label parse error: repository has invalid characters: "@rules_python~0.21.0~pip~pip//:boto3_pkg"

It looks like this error comes from using Gazelle's label.Parse, which depends on this regex.

I suspect it's unrelated, but I should also mention that I'm running a custom target selection query to pick up py_tests tagged external:

"attr('tags', '\bexternal\b', kind(py_test, //...))"
purkhusid commented 1 year ago

I already have a fix for this on the Gazelle side. Just waiting for it to be merged: https://github.com/bazelbuild/bazel-gazelle/pull/1508

mark-thm commented 1 year ago

@purkhusid thanks but your PR doesn't seem to add ~ to the repo regex, so I think it will not resolve this, sadly.