-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat: add support for separate GitHub app credentials #649
feat: add support for separate GitHub app credentials #649
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #649 +/- ##
==========================================
- Coverage 66.41% 66.27% -0.14%
==========================================
Files 22 22
Lines 2138 2150 +12
==========================================
+ Hits 1420 1425 +5
- Misses 587 591 +4
- Partials 131 134 +3 ☔ View full report in Codecov by Sentry. |
15573da
to
5036e73
Compare
…netes secrets Signed-off-by: Dustin Lactin <[email protected]>
5036e73
to
ad6d8a1
Compare
Signed-off-by: Dustin Lactin <[email protected]>
Signed-off-by: Dustin Lactin <[email protected]>
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.
Change LGTM so far, thank you!
I have just one request regarding error handling.
pkg/argocd/gitcreds.go
Outdated
intGithubAppID, _ := strconv.ParseInt(string(githubAppID), 10, 64) | ||
intGithubAppInstallationID, _ := strconv.ParseInt(string(githubAppInstallationID), 10, 64) |
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 think we really should check for error in string-to-number conversion.
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.
Ah yes, meant to add that after testing. I'll add it now!
Signed-off-by: Dustin Lactin <[email protected]>
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.
Small suggestion for returning the error, so that the error message may be more helpful to the user.
pkg/argocd/gitcreds.go
Outdated
// converting byte array to string and ultimately int64 for NewGitHubAppCreds | ||
intGithubAppID, err := strconv.ParseInt(string(githubAppID), 10, 64) | ||
if err != nil { | ||
return nil, err |
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.
return nil, err | |
return nil, fmt.Errorf("invalid value in field githubAppID: %w", err) |
just a tiny improvement to help with troubleshooting
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.
Wasn't sure if I could just commit the suggestions, so I added a new commit for these changes. Thank you!
pkg/argocd/gitcreds.go
Outdated
} | ||
intGithubAppInstallationID, _ := strconv.ParseInt(string(githubAppInstallationID), 10, 64) | ||
if err != nil { | ||
return nil, err |
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.
return nil, err | |
return nil, fmt.Errorf("invalid value in field githubAppInstallationID: %w", err) | |
just a tiny improvement to help with troubleshooting
…rsions Signed-off-by: Dustin Lactin <[email protected]>
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.
LGTM!
Thanks a lot for this PR, @dlactin. Appreciate it much!
) * feat: add support for separate GitHub app credentials stored as Kubernetes secrets Signed-off-by: Dustin Lactin <[email protected]> * test: added tests for consuming GitHub app credentials from a secret Signed-off-by: Dustin Lactin <[email protected]> * fix: added GitHub App placeholder words to expect.txt Signed-off-by: Dustin Lactin <[email protected]> * fix: checking for errors when converting GitHub App and Installation IDs Signed-off-by: Dustin Lactin <[email protected]> * fix: added more descriptive error messages for string-to-number conversions Signed-off-by: Dustin Lactin <[email protected]> --------- Signed-off-by: Dustin Lactin <[email protected]>
) * feat: add support for separate GitHub app credentials stored as Kubernetes secrets Signed-off-by: Dustin Lactin <[email protected]> * test: added tests for consuming GitHub app credentials from a secret Signed-off-by: Dustin Lactin <[email protected]> * fix: added GitHub App placeholder words to expect.txt Signed-off-by: Dustin Lactin <[email protected]> * fix: checking for errors when converting GitHub App and Installation IDs Signed-off-by: Dustin Lactin <[email protected]> * fix: added more descriptive error messages for string-to-number conversions Signed-off-by: Dustin Lactin <[email protected]> --------- Signed-off-by: Dustin Lactin <[email protected]>
This PR adds support for separate GitHub app credentials using the pre-existing GitHub App functions