-
Notifications
You must be signed in to change notification settings - Fork 733
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
Implement GitHub App API methods #522
Conversation
DeepCode analyzed this pull request. Click to see more details. |
…is still in preview
Added @Preview and @deprecated annotations to methods in which the API is still in preview |
ping @kohsuke @bitwiseman Hi guys, is there anything I can do to make this PR mergeable? |
would really ❤️ to see that merged, as its a pre-requisite to make Jenkins a GitHub App, which would help a lot, especially for bigger setups, see also https://issues.jenkins-ci.org/browse/JENKINS-57351 |
@PauloMigAlmeida This looks reasonable to me from cursory review. The I'm new to this project and very uncomfortable with how little testing it includes, but I also understand how testing is difficult in this area. Can you see any way to add more tests for these changes API? I would be far more comfortable if there were. |
@bitwiseman
You're correct. This doesn't break backwards API compatibility.
Absolutely! I think I can develop something using MockServer to mimic Github server responses and ensure that those new methods work as expected. Let me know if you have another strategy for testing it that you want me to follow. I will ping you once I've finished it (probably around tomorrow) |
@PauloMigAlmeida One of the clients of this library, the Jenkins github-branch-source-plugin has a number of WireMock-based tests, but I would be happy to see any reasonable set of automated tests. |
Add wiremock-standalone library; Signed-off-by: Paulo Almeida <[email protected]>
@bitwiseman Having said that, I implemented the tests using canned HTTP responses (WireMock-based tests). Let me know if you want me to change anything else before merging it. |
ping @bitwiseman |
# Conflicts: # pom.xml
ping @bitwiseman Let me know if there is anything you want me to change in order to get this approved. PS.: I saw that given the last few merges you did on the master branch caused this PR to conflict, so I just merged with the most up-to-date commit. |
Signed-off-by: Paulo Almeida <[email protected]>
@PauloMigAlmeida I have made a mocking framework that should simplify your tests some - each test method gets it's only directory which should mean you don't have to read each payload. Could you move this to use that structure and then I can do a final review? Why do most of the methods have |
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.
Update based on new test framework needed.
Hi @bitwiseman, all good. Sure, I can definitely update my tests to follow the new test framework. I will probably do it tomorrow. Stay tuned 😊 In regards to the preview/deprecated annotations, that’s a solution proposed by kohsuke for dealing with github preview apis. It is documented here: https://github.com/github-api/github-api/blob/master/src/main/java/org/kohsuke/github/Preview.java If that doesn’t apply anymore, let me know and I will gladly remove them |
@PauloMigAlmeida |
Signed-off-by: PauloMigAlmeida <[email protected]>
Signed-off-by: PauloMigAlmeida <[email protected]>
@bitwiseman Let me know if you need anything to be amended before you can merge it into master. |
ping @bitwiseman |
� Conflicts: � src/main/java/org/kohsuke/github/GitHubBuilder.java � src/test/java/org/kohsuke/github/GitHubTest.java
Remove servlet exclusion due to previous JDK version; Signed-off-by: PauloMigAlmeida <[email protected]>
I saw that the last few merges you did on the master branch caused this PR to conflict, so I just merged with the most up-to-date commit. I would love to hear from you if there is anything you want me to change so that we can get this merged 😄 |
@bitwiseman the build broke due to a legacy code which isn't connected to this PR. |
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.
This looks good to me.
Fixed the failures in master, so this is passing now. |
🎆 🎉 |
🤩🤩🤩🤩 |
This PR implements the GitHub Apps API workflow. Things to be noted:
I assumed that JWT is encoded externally and its JWT token is passed as a parameter to be used as an authentication mechanism (like it's done with the OAuth token currently). Implementing JWT encoding logic seemed too cumbersome for the project's value proposition (IMHO)
Methods that can only be requested via JWT as part of the Github App workflow are documented
On the
Requester
class, I had to make thewith(String key, Collection<String> value)
more generic as just adding another method likewith(String key, Collection<Integer> value)
wouldn't do the trick...and adding a specific method for this seemed weird...but let me know if you want to have this implemented in another way or if you're fine with the approach taken.If you find that this contribution is a good addition to the project, please accept this PR.
Best regards,