bazel-steward icon indicating copy to clipboard operation
bazel-steward copied to clipboard

${group}/${artifact} variables not working in title: for kinds: maven

Open vorburger opened this issue 1 year ago • 3 comments

Since I have added this in https://github.com/enola-dev/enola/commit/f201712d3006420cbfb42eb0dea40f695693fad3 :

- title: "Update ${group}/${artifact} from ${versionFrom} to ${versionTo}"
  commit-message: "deps: Update ${group}/${artifact} from ${versionFrom} to ${versionTo}"
  kinds: maven

Steward 🤵 raises e.g. https://github.com/enola-dev/enola/pull/1327 where the ${group}/${artifact} variables work in the commit message, but not PR title.

@lukaszwawrzyk perhaps this is easy to and worth fixing?

vorburger avatar Apr 23 '25 09:04 vorburger

I think the reason is with grouping + using maven group+artifact. As the artifacts are grouped there is no obvious substitution. Let me look at it.

lukaszwawrzyk avatar Apr 24 '25 08:04 lukaszwawrzyk

  - group-id: maven-resolver
    dependencies: "org.apache.maven.resolver:*"
    title: "Update ${dependencyId} from ${versionFrom} to ${versionTo}"
    commit-message: "deps: Update ${dependencyId} from ${versionFrom} to ${versionTo}"
  - group-id: maveniverse
    dependencies: "eu.maveniverse*:*"
    title: "Update ${dependencyId} from ${versionFrom} to ${versionTo}"
    commit-message: "deps: Update ${dependencyId} from ${versionFrom} to ${versionTo}"
  - group-id: rdf4j
    dependencies: "org.eclipse.rdf4j:*"
    title: "Update ${dependencyId} from ${versionFrom} to ${versionTo}"
    commit-message: "deps: Update ${dependencyId} from ${versionFrom} to ${versionTo}"
  - title: "Update ${group}/${artifact} from ${versionFrom} to ${versionTo}"
    commit-message: "deps: Update ${group}/${artifact} from ${versionFrom} to ${versionTo}"
    kinds: maven

As a temporary workaround, I can suggest to specify the more generic template for each group. I guess some yaml magic could reduce duplication. This is broken because for group, the library is seen through GroupId rather than MavenLibraryId and group and artifact are not avaialble as these can be arbitrary. I have to think about some reasonable solution to this scenario. Maybe if the template has unresolved variables, steward could fallback to more general template.

Ah, and another obvious alternative is to use {dependencyId} everywhere, but you'd have ${group}:${artifact} equivalent (: instead of /)

lukaszwawrzyk avatar Apr 24 '25 09:04 lukaszwawrzyk

Ah, and another obvious alternative is to use {dependencyId} everywhere, but you'd have ${group}:${artifact} equivalent (: instead of /)

Thank You very much for posting this suggestion! I've (for now) done this in https://github.com/enola-dev/enola/commit/613106e495c6e97482ad6605c827e5f69898774e - and it does the trick!

vorburger avatar Apr 30 '25 16:04 vorburger