Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci.jenkins.io repository scan of jenkins.io repo fails with a stack trace #3617

Closed
MarkEWaite opened this issue Jun 5, 2023 · 6 comments
Closed

Comments

@MarkEWaite
Copy link

Service(s)

ci.jenkins.io

Summary

The CI jobs for the www.jenkins.io documentation site are not being run on ci.jenkins.io because the repository scan is failing with the following message:

Checking pull request [#6434](https://github.com/jenkins-infra/jenkins.io/pull/6434)
ERROR: [Mon Jun 05 12:46:35 UTC 2023] Could not fetch branches from source e07a36ad-dfe8-498b-9509-8904b7e9f764
[Mon Jun 05 12:46:35 UTC 2023] Finished branch indexing. Indexing took 2.6 sec
FATAL: Failed to recompute children of Websites » jenkins.io
java.lang.IllegalArgumentException: No enum constant org.kohsuke.github.GHPermissionType.MAINTAIN
	at java.base/java.lang.Enum.valueOf(Enum.java:240)
	at org.kohsuke.github.GHPermission.getPermissionType(GHPermission.java:55)
	at org.kohsuke.github.GHRepository.getPermission(GHRepository.java:1096)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$1.fetch(GitHubSCMSource.java:1036)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRequest.getPermissions(GitHubSCMSourceRequest.java:450)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:323)
	at org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission.checkTrusted(ForkPullRequestDiscoveryTrait.java:310)
	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$4.create(GitHubSCMSource.java:1270)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$4.create(GitHubSCMSource.java:1264)
	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:339)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrievePullRequest(GitHubSCMSource.java:1261)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1099)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:282)
	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:654)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1057)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE

Reproduction steps

  1. Open the repository scan console at https://ci.jenkins.io/job/Websites/job/jenkins.io/indexing/console and see the stack trace
@MarkEWaite MarkEWaite added the triage Incoming issues that need review label Jun 5, 2023
@lemeurherve
Copy link
Member

lemeurherve commented Jun 5, 2023

MarkEWaite added a commit to MarkEWaite/github-api that referenced this issue Jun 5, 2023
Fixes hub4j#1671

https://community.jenkins.io/t/multibranch-pipline-fails-because-triage-enum-doesnt-exist/7800
reports that the TRIAGE permission is unknown to the GitHub api library.

jenkins-infra/helpdesk#3617 reports that the
MAINTAINER permission is unknown to the GitHub api library.

This adds both the triage and the maintain permission to the
enumeration so that new releases of the plugins depending on
this library can be done to avoid the stack trace reported in
jenkins-infra/helpdesk#3617

That stack trace includes:

java.lang.IllegalArgumentException: No enum constant org.kohsuke.github.GHPermissionType.MAINTAIN

Special thanks to @pierrebeitz for the test case with wiremock.
@hpsin
Copy link

hpsin commented Jun 5, 2023

👋 Hey all. We're rolling back the changes that triggered this issue.
We found that users assigned to the base role of triage or maintain were incorrectly shown as having the permission write or read base permission. These are legacy "base roles" that are used to build both custom roles as well as maintain and triage, and we were looking to fix that bug.

Since this is a string field, and not an enum, this did not trigger the breaking changes detection - but given the documentation it's reasonable that that's how folks implemented this. Further compounding the problem, the documentation failed to update, not that that would have helped avoid this breakage.

Given the reliance on this field, we're going to undo this change and freeze the base permission field to be this legacy value, with a note in the documentation as well. Systems interested in the user's assigned role instead of legacy base role can see the true role assignment in role_name.

Apologies this broke you, and my appreciation to the folks who got this to our attention.

@MarkEWaite
Copy link
Author

my appreciation to the folks who got this to our attention.

Our sincere appreciation to you for your rapid response. Thanks for hosting the Jenkins project.

@dduportal
Copy link
Contributor

@MarkEWaite is it ok to rollback the plugin to its mainline version then (on ci.jenkins.io) and close the issue?

@hpsin many many thanks for your help, the communication and efficiency!

@dduportal
Copy link
Contributor

Proceeding to reintsall the "non prerelease" plugin on ci.jenkins.io (that will trigger a controller restart)

@dduportal
Copy link
Contributor

Thanks everyone!

@dduportal dduportal added this to the infra-team-sync-2023-06-06 milestone Jun 6, 2023
@dduportal dduportal removed the triage Incoming issues that need review label Jun 6, 2023
garridobarrera added a commit to garridobarrera/github-api that referenced this issue Jun 9, 2023
* hub4j#1671 Create a test demoing the issue

* Add MAINTAIN and TRIAGE permissions to permission type

Fixes hub4j#1671

https://community.jenkins.io/t/multibranch-pipline-fails-because-triage-enum-doesnt-exist/7800
reports that the TRIAGE permission is unknown to the GitHub api library.

jenkins-infra/helpdesk#3617 reports that the
MAINTAINER permission is unknown to the GitHub api library.

This adds both the triage and the maintain permission to the
enumeration so that new releases of the plugins depending on
this library can be done to avoid the stack trace reported in
jenkins-infra/helpdesk#3617

That stack trace includes:

java.lang.IllegalArgumentException: No enum constant org.kohsuke.github.GHPermissionType.MAINTAIN

Special thanks to @pierrebeitz for the test case with wiremock.

* Avoid exceptions by returning an UNKNOWN enum as needed

When GitHub adds a new permission, return UNKNOWN with less permission
than NONE.

---------

Co-authored-by: Pierre Beitz <pibeitz@gmail.com>
Co-authored-by: Mark Waite <mark.earl.waite@gmail.com>
Co-authored-by: Carroll Chiou <cchiou@cloudbees.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants