ghprb-plugin icon indicating copy to clipboard operation
ghprb-plugin copied to clipboard

Can't update PR in a organization repository

Open Serginho opened this issue 4 years ago • 0 comments

In /jenkins/configure -> Github PR builder section. My account passed all tests of de the repo:

  • Test basic connection to GitHub
  • Test Permissions to a Repository
  • Test adding comment to Pull Request
  • Test updating commit status

But when I comment in the PR to trigger build, I'm getting this exception in jenkins log:

2020-06-09 11:08:00.844+0000 [id=20844]	INFO	o.j.plugins.ghprb.GhprbTrigger#handleComment: Checking comment on PR #2 for job Web Github PR lint
2020-06-09 11:08:00.986+0000 [id=20844]	SEVERE	o.j.p.ghprb.GhprbPullRequest#updatePR: Exception caught while updating the PR
java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/users/Serginho
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
	at org.kohsuke.github.GitHubHttpUrlConnectionClient.getResponseInfo(GitHubHttpUrlConnectionClient.java:69)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:362)
Caused: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/users/Serginho
	at sun.reflect.GeneratedConstructorAccessor440.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
	at org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo.bodyStream(GitHubHttpUrlConnectionClient.java:197)
	at org.kohsuke.github.GitHubResponse$ResponseInfo.getBodyAsString(GitHubResponse.java:321)
	at org.kohsuke.github.GitHubResponse.parseBody(GitHubResponse.java:114)
	at org.kohsuke.github.Requester.lambda$fetchInto$2(Requester.java:86)
	at org.kohsuke.github.GitHubClient.createResponse(GitHubClient.java:420)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:374)
Caused: org.kohsuke.github.HttpException: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
	at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:454)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:382)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:326)
	at org.kohsuke.github.Requester.fetchInto(Requester.java:86)
	at org.kohsuke.github.GHPerson.populate(GHPerson.java:57)
	at org.kohsuke.github.GHPerson.getName(GHPerson.java:212)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.updatePR(GhprbPullRequest.java:337)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:304)
	at org.jenkinsci.plugins.ghprb.GhprbRepository.onIssueCommentHook(GhprbRepository.java:358)
	at org.jenkinsci.plugins.ghprb.GhprbTrigger.handleComment(GhprbTrigger.java:738)
	at org.jenkinsci.plugins.ghprb.GhprbRootAction$1.run(GhprbRootAction.java:238)
2020-06-09 11:08:00.987+0000 [id=20844]	SEVERE	o.j.p.ghprb.GhprbRootAction$1#run: Unable to handle comment for PR# 428388374, repo: TuLotero/jenkins-build-test
java.lang.NullPointerException
	at org.jenkinsci.plugins.ghprb.Ghprb.checkSkipBuildPhrase(Ghprb.java:163)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.checkSkipBuild(GhprbPullRequest.java:277)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:307)
	at org.jenkinsci.plugins.ghprb.GhprbRepository.onIssueCommentHook(GhprbRepository.java:358)
	at org.jenkinsci.plugins.ghprb.GhprbTrigger.handleComment(GhprbTrigger.java:738)
	at org.jenkinsci.plugins.ghprb.GhprbRootAction$1.run(GhprbRootAction.java:238)

It works well with my own repository but when I created an organization, the plugin starts failing

Serginho avatar Jun 09 '20 11:06 Serginho