-
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
Enable fetch plan for current app and account #1630
Enable fetch plan for current app and account #1630
Conversation
pom.xml
Outdated
@@ -600,6 +600,12 @@ | |||
<version>2.0.3</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> |
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.
Used to facilitate loading a custom private JWK for a GHApp
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.
Is there an other option aside from adding a new test dependency? How much work does this save?
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.
I considered relying on jjwt, but the feature does not exist yet into there, and people points back to nimbus-jose: jwtk/jjwt#236 (comment)
I would have to go through the JWK to PEM procedure, which is a burden given my own setup (i.e. my app using this lib relies on a JWK, not a PEM). Also, it would be more error-prone to rely on a given PEM content through environment variable (which is again my setup, and how I suggest to manage custom privateKey here).
I tried copying some classes from Nimbus to fill the gap, but it seems to require quite a bunch of classes. I'm having another try but focusing on the minimal set of methods to get a PrivateKey
.
My only justification for this additional lib is existing tests for GitHub App APIs has not dynamic mechanisms for now (neither from local file, or from Env). I may then just drop this code, and be potentially discouraged to contribute here (this is a weak argument as I would be happy to fit into any existing mechanism, the current option would be to copy my own privateKey as a test resources, with a risk of pushing it publicly).
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.
I'm dropping nimbus, with a mechanism to load a PEM from a Path
provided as environment variable (similarly to the pushed code). However, I will not be a user of this mechanism. It will pave the way for next contribution requiring a custom JWK.
It looks like you're still working on this. Setting to |
GHApp app = gitHub.getApp(); | ||
|
||
GHAppInstallation appInstallation; | ||
if (Set.of(TEST_APP_ID_1, TEST_APP_ID_2, TEST_APP_ID_3).contains(Long.toString(app.getId()))) { |
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 switch leads to invalid recordings: I've done it to prevent recording the N installations of my real-world app. However, when re-running the tests without my custom JWK, the test will list all installations, which will match no stub (as we recorded the other branch of the if
, which was focusing on a dedicated repo.)
This remain useful, however one has to edit the recordings manually (e.g. copy-pasting the installations listing from another test).
@bitwiseman Would you mind granting me access to the test repo/app ? It may be useful on related matters not requiring markplace-listing.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1630 +/- ##
============================================
+ Coverage 79.86% 79.88% +0.02%
- Complexity 2191 2195 +4
============================================
Files 208 209 +1
Lines 6659 6667 +8
Branches 364 364
============================================
+ Hits 5318 5326 +8
Misses 1127 1127
Partials 214 214
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
(As a side-note, the Wiremock tooling to stub |
@bitwiseman This is ready for review/merging. |
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.
Missing coverage for one method. Fix that and we can merge.
Thanks! |
Description
Fixes #1613
This enables accessing the plan with current GithubApp on current GHInstallation.
Before submitting a PR:
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: