github-integration-plugin icon indicating copy to clipboard operation
github-integration-plugin copied to clipboard

No reaction on <Сomment Pattern> starting from 31 comment in PR

Open maxvasylets opened this issue 4 years ago • 12 comments

The plugin works fine and reacts to Comment Pattern until we have more than 30 comments.

I did some research and I found that it's probably related to this code: GitHubPRCommentEvent.java#L57

In this code you request PR comments from GitHub, but by default GitHub returns only the first 30 comments and if you need to get more you should specify page number.

This plugin looks great but this issue blocks us to use it for production usage. I'd appreciate it if we can find a solution and fix this issue.

How to manually check comments and pagination: curl -H "Authorization: token <github-access-token>" -X GET https://api.github.com/repos/<owner>/<repo-name>/issues/<pr-number>/comments curl -H "Authorization: token <github-access-token>" -X GET https://api.github.com/repos/<owner>/<repo-name>/issues/<pr-number>/comments?page=2

Useful links: https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue

GitHub PR Polling Log: Running GitHub Pull Request trigger check for May 21, 2020 9:16:07 PM on <repo-name> GitHub rate limit before check: GHRateLimit {core {remaining=4979, limit=5000, resetDate=Thu May 21 22:11:00 UTC 2020}search {remaining=30, limit=30, resetDate=Thu May 21 21:17:07 UTC 2020}graphql {remaining=5000, limit=5000, resetDate=Thu May 21 22:16:07 UTC 2020}integrationManifest {remaining=5000, limit=5000, resetDate=Thu May 21 22:16:07 UTC 2020}} No matching comments found for 4 Finished GitHub Pull Request trigger check for <repo-name> at May 21, 2020 9:16:08 PM. Duration: 1301ms

maxvasylets avatar May 21 '20 21:05 maxvasylets

Probably adding since may help. Internally it stores the last comment..

KostyaSha avatar May 22 '20 00:05 KostyaSha

Looks like https://github.com/hub4j/github-api/blob/495a46e2d87c26add983cc0bfd803ad5466f3678/src/main/java/org/kohsuke/github/GHIssue.java#L429-L451 doesn't support pages and since tag. Need to be implemented in library first

KostyaSha avatar May 22 '20 00:05 KostyaSha

Correct me if I'm wrong. As I can see You can just use listComments() method instead of getComments() and get paged iterable result.

maxvasylets avatar May 22 '20 07:05 maxvasylets

Shouldn't then it get all pages?

KostyaSha avatar May 22 '20 12:05 KostyaSha

yes, all comments from all pages

maxvasylets avatar May 22 '20 13:05 maxvasylets

After some research, I found that github-api library works fine and the method getComments() returns all available comments in PR. So the issue seems in this plugin.

maxvasylets avatar Jul 13 '20 21:07 maxvasylets

do you have cache enabled in connector?

KostyaSha avatar Jul 13 '20 21:07 KostyaSha

Job > configure > GitHub Pull Requests > GitHub Plugin Repository Provider > Cache connection = true

Anyway, I've tested with Cache connection = false also.

maxvasylets avatar Jul 14 '20 07:07 maxvasylets

Same issue. Any update or workaround ?

prawen avatar Aug 04 '20 04:08 prawen

I have no idea what may be wrong. GH api library returns full list of comment that iterated according to date of the previous check. Either library is broken somehow... Nearest issue with extra builds is also related to comments and date. I can add extra logging into DEBUG/TRACE level of corresponding class. Would you be able to capture/check then?

KostyaSha avatar Aug 30 '20 22:08 KostyaSha

I don't use it in prod because of this issue but I can try to reproduce this situation on the stand and share logs then.

maxvasylets avatar Aug 31 '20 18:08 maxvasylets

I also see this here. Ive been rebuilding a CI on a new system and have been using my own repo to test, so just throwing in my rebuild string as a comment after a certain amount (apparently 31) in test PRs it stops actually triggering

ezelkow1 avatar Mar 25 '21 02:03 ezelkow1