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

#100: Fix retrieval of authentication tokens on Github enterprise hosts #115

Merged
merged 2 commits into from
May 24, 2020

Conversation

kennyko
Copy link
Contributor

@kennyko kennyko commented Mar 2, 2020

Updated configuration description to be in line with the documentation on https://docs.sonarqube.org/latest/instance-administration/github-application/
Add support for GitHub Enterprise installations with both a /v3 in the URL and without.

Resolves #100

@kennyko kennyko changed the title 100: Fix retrieval of authentication tokens on Github enterprise hosts #100: Fix retrieval of authentication tokens on Github enterprise hosts Mar 2, 2020
Copy link
Owner

@mc1arke mc1arke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Could you add unit tests to cover these changes please?

@kennyko kennyko force-pushed the issue/100 branch 2 times, most recently from f657447 to 7601a40 Compare March 26, 2020 21:37
@kennyko kennyko requested a review from mc1arke March 26, 2020 21:38
@kennyko
Copy link
Contributor Author

kennyko commented Apr 2, 2020

@mc1arke are you able to take a look at this pull request again?

mc1arke
mc1arke previously approved these changes Apr 20, 2020
@mc1arke
Copy link
Owner

mc1arke commented Apr 20, 2020

Please squash your commits so we have a single commit for this feature

@kennyko
Copy link
Contributor Author

kennyko commented Apr 20, 2020

Done

…ise hosts

Github.com's API does not contain version numbers in the path for REST endpoints (e.g. api.github.com/endpoint), but Github Enterprise does (e.g. github.company.net/api/v3/endpoint), however neither platforms use version numbers in the Graphql endpoint (e.g. api.github.com/graphql and github.company.net/api/graphql). The plugin was not previously differentiating between the two possible platforms based on the configured base URL, so was using the wrong REST endpoint when performing the authentication request, or was targeting the wrong graphql url if the user configured the URL to end with `v3`. Checking if the configured URL ends with `api` indicates the URL is Github enterprise rather than Github.com, so now had `v3` appended to it for the authentication request.

This change will also support GitHub Enterprise URLs with or without a trailing `v3/` in the endpoint.
@mc1arke mc1arke merged commit 49626f7 into mc1arke:master May 24, 2020
@mc1arke
Copy link
Owner

mc1arke commented May 24, 2020

Merged. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PullRequestPostAnalysisTask fail with GraphQLException: Not Found
2 participants