RFR: 2159: CheckRun repeats search for backport commit on each evaluation

Erik Joelsson erikj at openjdk.org
Fri Jan 26 21:13:38 UTC 2024


On Fri, 26 Jan 2024 19:01:00 GMT, Zhao Song <zsong at openjdk.org> wrote:

> As Erik said in the issue description, when skara bot is searching for the original commit for a backport port, it's very inefficient for GitLab because GitLab doesn't provide the good rest api as GitHub for the bot to search for a commit by hash. So Skara have no choice but go through all the repositories and it's very slow right now.
> 
> To fix it, we could store the repository name together with the commit hash in the comment, therefore the bot will only need to run the search once.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java line 487:

> 485:         if (repo.isEmpty()) {
> 486:             throw new IllegalStateException("Backport comment for PR " + pr.id() + " contains bad repo name: " + repoName);
> 487:         }

I think we need a fallback for all the existing PRs that currently don't have the repo stored in the comment.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 530:

> 528:                 var repoName = forge.search(hash);
> 529:                 if (repoName.isPresent()) {
> 530:                     var metadata = forge.repository(repoName.get()).flatMap(repository -> repository.commit(hash));

I find the naming of this variable confusing. Can we just call it `commit`?

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

PR Review Comment: https://git.openjdk.org/skara/pull/1605#discussion_r1468141425
PR Review Comment: https://git.openjdk.org/skara/pull/1605#discussion_r1468143332


More information about the skara-dev mailing list