-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add MAINTAIN and TRIAGE permissions #1672
Conversation
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.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1672 +/- ##
=========================================
Coverage 79.93% 79.93%
Complexity 2208 2208
=========================================
Files 212 212
Lines 6687 6689 +2
Branches 364 364
=========================================
+ Hits 5345 5347 +2
Misses 1128 1128
Partials 214 214
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in #1671 (comment) I would suggest adding an UNKNOWN
or OTHER
constant and making GHPermission.getPermissionType
fall back to that.
I do not believe any change to github-branch-source
is required since https://github.com/jenkinsci/github-branch-source-plugin/blob/d391eef681ae51743402ef08deac2b94565b09aa/src/main/java/org/jenkinsci/plugins/github_branch_source/ForkPullRequestDiscoveryTrait.java#L319-L325 only cares about ADMIN
and WRITE
. You should of course push a release of https://plugins.jenkins.io/github-api/.
When GitHub adds a new permission, return UNKNOWN with less permission than NONE.
@bitwiseman Looks like I don't have release permissions. would you be able to cut a release for this issue? many thanks! |
Better hold off until we have analyzed the impact of the GitHub.com rollback. |
As far as I can tell, the new entries in the enumeration do not harm the plugin even after the GitHub REST API rollback. The rollback has happened and scan repository is working as expected with the patched github API library. GitHub announced I'm OK if we roll back this change and hope that GitHub won't make this type of change in the future, or we could partially revert it so that we don't add |
Add MAINTAIN and TRIAGE permissions to permission type
I've not included links to the GitHub REST API documentation describing those pemrissions because I've been unable to find them listed in the REST API documentation. I'm confident that they are in the documentation, but my search and navigation skills are insufficient to find them.
Failures for MAINTAIN permission on ci.jenkins.io are documented in:
Failures for TRIAGE permission on other systems are documented in:
Special thanks to @PierreBietz for his investigation work and the test case that shows the issue.
Requesting review from @jglick and @basil in case I've missed something important in the implementation.
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: