RFR: 1068: [Backport] Bot finds original commit in wrong repository

Erik Joelsson erikj at openjdk.java.net
Thu Jul 15 16:44:54 UTC 2021


When the PR bot searches for the original commit for a backport it's more or less random from which repository it will be found. Whatever it finds is posted as a link in a PR comment, and if it points to something weird, that can be confusing (though not strictly incorrect as the change will be the exact same regardless of which repo it is in).

The search feature already has what looks to be a configurable way to limit searching to a set of organizations. Unfortunately, that feature was never used and is currently broken for Github (for Gitlab it's already in use as it's required for the search method we use). Because of this, we usually pick a match from adoptium or SAP today. This patch fixes this for Github (where the query separator is space, not '+'), and I intend to limit the organizations to "openjdk" when deploying this fix.

In addition to this, it would be nice if the exact repo that gets picked is the "correct" one. Unfortunately, there is no really good definition of what the correct repo would be in all cases, and it would be even trickier to implement this in a good way. As an approximate workaround, I've added sorting on repository name length, so we always pick the repo with the shortest name. I believe this will at least give us a better answer than "random" in most cases for a relatively modest cost in performance.

I have experimented with this patch in staging with the playground repo and the behavior I've seen so far is good.

-------------

Commit messages:
 - Also sort for gitlab
 - Prioritize repo with shortest name in hash search result
 - Remove + from github query string

Changes: https://git.openjdk.java.net/skara/pull/1203/files
 Webrev: https://webrevs.openjdk.java.net/?repo=skara&pr=1203&range=00
  Issue: https://bugs.openjdk.java.net/browse/SKARA-1068
  Stats: 15 lines in 2 files changed: 10 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/skara/pull/1203.diff
  Fetch: git fetch https://git.openjdk.java.net/skara pull/1203/head:pull/1203

PR: https://git.openjdk.java.net/skara/pull/1203


More information about the skara-dev mailing list