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

Add handling for github enterprise #114

Merged
merged 4 commits into from
Nov 15, 2021

Conversation

kirillbilchenko
Copy link
Contributor

@kirillbilchenko kirillbilchenko commented Nov 4, 2021

Adding handling for github enterprise when the model looks different
Fixing issue with 109

Signed-off-by: kbilchenko [email protected]

@xtremerui xtremerui self-assigned this Nov 5, 2021
@@ -91,6 +93,7 @@ func NewGitHubClient(source Source) (*GitHubClient, error) {
v4URL = source.GitHubAPIURL + "graphql"
}
clientV4 = githubv4.NewEnterpriseClient(v4URL, httpClient)
isEnterprise = true
Copy link
Contributor

Choose a reason for hiding this comment

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

this is basically saying once souce.GitHubAPIURL is provided then it is an enterprise github deployment. Is that true? Could a github deployment be public but not enterprise version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this one case I belive if you are providing something what is not default github api, we should consider this as github enterprise but I may be wrong there

Copy link
Contributor

Choose a reason for hiding this comment

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

at least isEnterprise = true should be set whenever NewEnterpriseClient is called

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is what is happening, when we have case with custom url, we are assuming that enterprise client will be used

)

func (g *GitHubClient) listReleasesV4EnterPrice() ([]*github.RepositoryRelease, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you already have g.isEnterprise available in GitHubClient, so you could modify that existing list releases method instead of adding an almost identicle one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, but since it's a temporary solution, the logic of the method is almost the same, but for every reference I need to use another payload for making request, so I decided just to create new one, instead of huge if-else condition everywhere

@kirillbilchenko
Copy link
Contributor Author

@xtremerui can you check my answers, and let me know if it's enough for now?

@@ -91,6 +93,7 @@ func NewGitHubClient(source Source) (*GitHubClient, error) {
v4URL = source.GitHubAPIURL + "graphql"
}
clientV4 = githubv4.NewEnterpriseClient(v4URL, httpClient)
isEnterprise = true
}

if source.GitHubV4APIURL != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

should isEnterprise be set here as well? Since here you are also creating a v4 client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

model.go Show resolved Hide resolved
Co-authored-by: Rui Yang <[email protected]>
Signed-off-by: kbilchenko <[email protected]>
@xtremerui xtremerui merged commit 5fcc3a5 into concourse:master Nov 15, 2021
@kirillbilchenko
Copy link
Contributor Author

@xtremerui just a question, you merged this, but it was never released as a new version, any reason for this?

@kirillbilchenko kirillbilchenko deleted the github_enterprise_fix branch December 6, 2021 15:51
@xtremerui
Copy link
Contributor

@kirillbilchenko we don't do a release of resource type itself usually. It will be with concourse 7.7.

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.

2 participants