[JIRA] (JENKINS-56996) null permission lookup when pull-request's origin repo/branch is deleted on github

37 views
Skip to first unread message

docwhat@gerf.org (JIRA)

unread,
Apr 12, 2019, 4:56:06 PM4/12/19
to jenkinsc...@googlegroups.com
Christian Höltje created an issue
 
Jenkins / Bug JENKINS-56996
null permission lookup when pull-request's origin repo/branch is deleted on github
Issue Type: Bug Bug
Assignee: Unassigned
Components: github-branch-source-plugin
Created: 2019-04-12 20:55
Environment: Jenkins 2.164.1
git: 4.0.0-rc
git-client: 3.0.0-rc
git-server: 1.7
github: 1.29.4
github-api: 1.95
github-branch-source: 2.4.5
github-oauth: 0.31
github-pr-coverage-status: 2.0.0
pipeline-github: 2.5
pipeline-github-lib: 1.0
Priority: Major Major
Reporter: Christian Höltje

We use GitHub Organizations to manage our jobs.

We found a bug where if a pull request has its source repository/branch deleted (e.g. it was a personal fork and that personal fork was deleted) then that repository stops updating from github.

Here is the log from the "Scan Repository Log':

    Checking pull request #154
ERROR: [Fri Apr 12 16:39:29 EDT 2019] Could not fetch branches from source org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator::https://github.example.com/api/v3::robert-continuous-delivery::howard
java.io.FileNotFoundException: https://github.example.com/api/v3/repos/robert-continuous-delivery/howard/collaborators/null/permission
	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
	at org.kohsuke.github.Requester.parse(Requester.java:625)
	at org.kohsuke.github.Requester.parse(Requester.java:607)
	at org.kohsuke.github.Requester._to(Requester.java:285)
Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"null is not a user","documentation_url":"https://developer.github.com/enterprise/2.16/v3/repos/collaborators/#review-a-users-permission-level"}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:699)
	at org.kohsuke.github.Requester._to(Requester.java:306)
	at org.kohsuke.github.Requester.to(Requester.java:247)
	at org.kohsuke.github.GHRepository.getPermission(GHRepository.java:529)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$1.fetch(GitHubSCMSource.java:904)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRequest.getPermissions(GitHubSCMSourceRequest.java:474)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:344)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:327)
	at jenkins.scm.api.trait.SCMHeadAuthority.isTrusted(SCMHeadAuthority.java:101)
	at jenkins.scm.api.trait.SCMSourceRequest.isTrusted(SCMSourceRequest.java:213)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$3.create(GitHubSCMSource.java:970)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$3.create(GitHubSCMSource.java:964)
	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:339)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:960)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
[Fri Apr 12 16:39:29 EDT 2019] Finished branch indexing. Indexing took 3.6 sec
FATAL: Failed to recompute children of Jenkins: Continuous Delivery » howard
org.kohsuke.github.GHFileNotFoundException: {"message":"null is not a user","documentation_url":"https://developer.github.com/enterprise/2.16/v3/repos/collaborators/#review-a-users-permission-level"}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:699)
	at org.kohsuke.github.Requester._to(Requester.java:306)
	at org.kohsuke.github.Requester.to(Requester.java:247)
	at org.kohsuke.github.GHRepository.getPermission(GHRepository.java:529)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$1.fetch(GitHubSCMSource.java:904)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRequest.getPermissions(GitHubSCMSourceRequest.java:474)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:344)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:327)
	at jenkins.scm.api.trait.SCMHeadAuthority.isTrusted(SCMHeadAuthority.java:101)
	at jenkins.scm.api.trait.SCMSourceRequest.isTrusted(SCMSourceRequest.java:213)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$3.create(GitHubSCMSource.java:970)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$3.create(GitHubSCMSource.java:964)
	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:339)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:960)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.FileNotFoundException: https://github.example.com/api/v3/repos/robert-continuous-delivery/howard/collaborators/null/permission
	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
	at org.kohsuke.github.Requester.parse(Requester.java:625)
	at org.kohsuke.github.Requester.parse(Requester.java:607)
	at org.kohsuke.github.Requester._to(Requester.java:285)
	... 20 more
Finished: FAILURE
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

bitwiseman@gmail.com (JIRA)

unread,
Apr 29, 2019, 7:12:02 PM4/29/19
to jenkinsc...@googlegroups.com
Liam Newman commented on Bug JENKINS-56996
 
Re: null permission lookup when pull-request's origin repo/branch is deleted on github

Christian Höltje
So, the issue is that the updating of all PRs stops, not that this one PR doesn't refresh (which is understandable). Is that correct?

docwhat@gerf.org (JIRA)

unread,
Apr 30, 2019, 2:33:02 PM4/30/19
to jenkinsc...@googlegroups.com

So, the issue is that the updating of all PRs stops, not that this one PR doesn't refresh (which is understandable). Is that correct?

The scanning for the entire organization folder (and down) stops, nothing new gets added or removed.

bitwiseman@gmail.com (JIRA)

unread,
May 1, 2019, 10:45:02 AM5/1/19
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
May 1, 2019, 10:45:03 AM5/1/19
to jenkinsc...@googlegroups.com
Liam Newman commented on Bug JENKINS-56996
 
Re: null permission lookup when pull-request's origin repo/branch is deleted on github

Christian Höltje
Right, that's what I thought you were saying. Thanks, I'm working on this.

bitwiseman@gmail.com (JIRA)

unread,
May 1, 2019, 11:21:02 PM5/1/19
to jenkinsc...@googlegroups.com

Wow.
I did't some digging on this and it is not particularly easy.

I'd love to be able to simply catch and swallow some error locally, but if we do that it may result in jobs being deleted (or marked for deletion) simply because there was an error while reading them. I looked pretty carefully and I didn't see a way to address this safely in a small/local change.

The core problem is that the code that controls how child items are created and maintained is spread across several other plugins, including folders, scm-api and branch-api.

My thought is that we'll need to add a no-op

{preserve(String itemName)}

method to

{[SCMHeadObserver|https://github.com/jenkinsci/scm-api-plugin/blob/6a044fe60143278ed26f8d91b0ec1cee116617d6/src/main/java/jenkins/scm/api/SCMHeadObserver.java#L43]}

. Then we can wire through an implementation in MultiBranchProject.SCMHeadObserverImpl. Finally, we'd expose that in github-branch-source for the

{GitHubSCMSource}

to call when an error occurs.

bitwiseman@gmail.com (JIRA)

unread,
May 1, 2019, 11:23:02 PM5/1/19
to jenkinsc...@googlegroups.com
Liam Newman edited a comment on Bug JENKINS-56996
Wow.
I did't some digging on this and it is not particularly easy.

I'd love to be able to simply catch and swallow some error locally, but if we do that it may result in jobs being deleted (or marked for deletion) simply because there was an error while reading them.  I looked pretty carefully and I didn't see a way to address this safely in a small/local change.

The core problem is that the code that controls how child items are created and maintained is spread across several other plugins, including folders, scm-api and branch-api.



My thought is that we'll need to add a no-op { { preserve(String itemName)} } method to { { [SCMHeadObserver|https://github.com/jenkinsci/scm-api-plugin/blob/6a044fe60143278ed26f8d91b0ec1cee116617d6/src/main/java/jenkins/scm/api/SCMHeadObserver.java#L43]} } .

  Finally, we'd expose that in github-branch-source for the { { GitHubSCMSource} } to call when an error occurs.   

bitwiseman@gmail.com (JIRA)

unread,
May 2, 2019, 11:34:02 AM5/2/19
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
May 2, 2019, 11:37:02 AM5/2/19
to jenkinsc...@googlegroups.com


I suppose it would okay for PRs specifically to simply be deleted on {{FileNotFoundException}} specifically, but not great behavior.   

bitwiseman@gmail.com (JIRA)

unread,
May 3, 2019, 10:35:02 AM5/3/19
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
May 3, 2019, 7:29:02 PM5/3/19
to jenkinsc...@googlegroups.com
Liam Newman started work on Bug JENKINS-56996
 
Change By: Liam Newman
Status: Open In Progress

bitwiseman@gmail.com (JIRA)

unread,
May 3, 2019, 7:29:02 PM5/3/19
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
May 7, 2019, 10:36:02 AM5/7/19
to jenkinsc...@googlegroups.com
Liam Newman commented on Bug JENKINS-56996
 
Re: null permission lookup when pull-request's origin repo/branch is deleted on github

Christian Höltje

Please try this version: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/github-branch-source/2.5.2-rc835.5125eb8241d3/

It should make you scan not fail due to issues with one PR. NOTE: PRs that experience errors will be marked "orphaned" (and possibly deleted depending on your orphan strategy).

bitwiseman@gmail.com (JIRA)

unread,
May 7, 2019, 9:35:02 PM5/7/19
to jenkinsc...@googlegroups.com
 

I'm going to resolve this as fixed and move forward.
Christian Höltje Please comment if this is not fixed for you.

Change By: Liam Newman
Status: In Review Resolved
Resolution: Fixed

bitwiseman@gmail.com (JIRA)

unread,
May 8, 2019, 8:37:02 PM5/8/19
to jenkinsc...@googlegroups.com
 
Re: null permission lookup when pull-request's origin repo/branch is deleted on github

Released as part of v2.5.2, waiting to close until we hear from reporter.

bitwiseman@gmail.com (JIRA)

unread,
May 9, 2019, 10:02:01 PM5/9/19
to jenkinsc...@googlegroups.com
Liam Newman edited a comment on Bug JENKINS-56996
Wow.
I did
't some digging on this and it is not particularly easy.

I'd love to be able to simply catch and swallow some error locally, but if we do that it may result in jobs being deleted (or marked for deletion) simply because there was an error while reading them. I looked pretty carefully and I didn't see a way to address this safely in a small/local change.

The core problem is that the code that controls how child items are created and maintained is spread across several other plugins, including folders, scm-api and branch-api.

My thought is that we'll need to add a no-op {{preserve(String itemName)}} method to {{[SCMHeadObserver|https://github.com/jenkinsci/scm-api-plugin/blob/6a044fe60143278ed26f8d91b0ec1cee116617d6/src/main/java/jenkins/scm/api/SCMHeadObserver.java#L43]}}.

Then we can wire through an implementation in {{[MultiBranchProject.SCMHeadObserverImpl|https://github.com/jenkinsci/branch-api-plugin/blob/ed229d8e1392645c99e5686b8bd652a14ec87f4a/src/main/java/jenkins/branch/MultiBranchProject.java#L1948]}}.

Finally, we'd expose that in github-branch-source for the {{GitHubSCMSource}} to call when an error occurs.

I suppose it would okay for PRs specifically to simply be deleted on {{FileNotFoundException}} specifically, but not great behavior.   
Reply all
Reply to author
Forward
0 new messages