Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for full combination of co-ordinates in bazel #31513

Open
rarkins opened this issue Sep 21, 2024 Discussed in #31313 · 2 comments
Open

Support for full combination of co-ordinates in bazel #31513

rarkins opened this issue Sep 21, 2024 Discussed in #31313 · 2 comments
Labels
manager:bazel Bazel WORKSPACE files priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Sep 21, 2024

Discussed in #31313

Reproduced in https://github.com/renovate-reproductions/31313

Originally posted by daniel-b2c2 September 10, 2024

What would you like help with?

I think I found a bug/coverage issue

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

GitHub 38.38.1

Please tell us more about your question or problem

While groupId:artifactId:version is the most common way of defining co-ordinates for 99% of usecases, there are occasionally more complex co-ordinates that involve specifying the packaging and classifier.

The full set of valid co-ordinate patterns can be seen here for bazel, the problem is that renovate only comprehends the 3-arity form, and [speculating] either doesn't support 4,5-arity, or there is a bug in 4,5-arity.

image

Spec:
https://github.com/bazelbuild/rules_jvm_external/blob/master/specs.bzl#L132

Using this particular maven artifact as a great example of 5-arity: https://repo1.maven.org/maven2/io/netty/netty-transport-native-epoll/4.1.113.Final/

It is necessary to specify the packaging as jar and the classifier linux-x86_64 as part of the co-ordinates so

"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.87.Final (5-arity) is valid in a maven_install file.

Current behaviour:
when renovate raises a PR for a 5-arity entry, it incorrectly offers io.netty:netty-transport-native-epoll:4.1.113.Final:linux-x86_64:4.1.87.Final as the upgrade replacing the third element (jar) with the new version.

Expected behaviour:
when renovate raises a PR for a 5-arity entry, it should offer io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.113.Final with the last element in the array being upgraded.

This seeps into the PR too where the table of upgrades shows jar -> 4.1.113.Final

Similarly for 4-arity which using the example above would be io.netty:netty-transport-native-epoll:jar:4.1.113.Final

Current workaround:

We are closing the PRs and doing the upgrade manually.

Logs (if relevant)

Logs

Replace this text with your logs, between the starting and ending triple backticks

Example project:
This project has 2 maven dependencies, one of arity-4 and one of arity-5. It fails to correctly upgrade either of them as shown in this PR:
https://github.com/daniel-b2c2/bazel-java-arity/pull/3/files

@rarkins rarkins added type:feature Feature (new functionality) priority-4-low Low priority, unlikely to be done unless it becomes important to more people manager:bazel Bazel WORKSPACE files labels Sep 21, 2024
@rarkins
Copy link
Collaborator Author

rarkins commented Sep 21, 2024

For strings like io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.113.Final, we should see:

  • packageName is io.netty:netty-transport-native-epoll
  • currentValue is 4.1.113.Final

rarkins added a commit that referenced this issue Sep 30, 2024
Fixes #31513

Add support for 4-arity and 5-arity Maven coordinates in Bazel.

* Update `lib/modules/datasource/maven/util.ts` to parse 4-arity and 5-arity coordinates.
* Update `lib/modules/manager/bazel/rules/maven.ts` to handle 4-arity and 5-arity coordinates and move packaging and classifier fields inside `managerData`.
* Add tests in `lib/modules/manager/bazel/rules/maven.spec.ts` for `MavenTarget` schema to ensure it handles 4-arity and 5-arity coordinates.
* Update `lib/modules/manager/bazel/extract.spec.ts` to add tests for `extractPackageFile` function to ensure it correctly handles 4-arity and 5-arity coordinates.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/renovatebot/renovate/issues/31513?shareId=XXXX-XXXX-XXXX-XXXX).
@daniel-b2c2
Copy link

I'd like to summarise a workaround I found for this issue:

Since renovate supports the concept of regex via the regex managers, you can define a regex to capture these edge-cases and even group them correctly with other 'grouped' entries.

I have been using this method reliably for the past 3 months or so, and it works very well. 🙏

@rarkins rarkins added type:feature Feature (new functionality) and removed type:feature Feature (new functionality) labels Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:bazel Bazel WORKSPACE files priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants