git-xargs icon indicating copy to clipboard operation
git-xargs copied to clipboard

Add support for Github enterprise instances

Open zackproser opened this issue 4 years ago • 4 comments

Related: https://github.com/gruntwork-io/fetch/pull/43

zackproser avatar Apr 21 '21 12:04 zackproser

Would adding baseUrl support be enough to work with other git providers? (e.g. Gitlab)

ejstreet avatar Apr 21 '21 17:04 ejstreet

Hi @ejstreet,

Thanks for the great question. Git-xargs grew organically out of an internal tool at Gruntwork, where we exclusively use Github, so the tool currently pre-supposes Github as the version control system for opening PRs.

So, I think adding support for additional git providers would be a bit more involved. One initial thought about approaching this is that we could create an interface for a version control provider. For example, the interface would have a method like OpenPullRequest and then we could create a concrete implementation for Github, Gitlab, etc and provide additional CLI flags and fallback behavior for choosing which VCS provider to use at runtime.

We might also consider implementing a config file and syntax for it if we go down that route. That all said, it sounds like discussion might be better split into a new ticket specifically about adding support for other version control providers like Gitlab, Bitbucket, etc (whereas this ticket is about supporting Github enterprise instances.)

I have an internal backlog of git-xargs issues I still need to migrate to this repo, so I will open one there (or you could feel free to open a new ticket specifically for supporting other version control providers).

Thanks!

zackproser avatar Apr 21 '21 18:04 zackproser

I ran into this issue as well. Until there's a robust solution, this worked for me in GitHub Enterprise.

diff --git a/auth/auth.go b/auth/auth.go
index 73ac8c0..b07d8ac 100644
--- a/auth/auth.go
+++ b/auth/auth.go
@@ -52,7 +52,8 @@ func ConfigureGithubClient() GithubClient {
 	tc := oauth2.NewClient(context.Background(), ts)
 
 	// Wrap the go-github client in a GithubClient struct, which is common between production and test code
-	client := NewClient(github.NewClient(tc))
+	_client, _ := github.NewEnterpriseClient("https://${INSERT_BASE_URL_HERE}/api/v3/", "${INSERT_BASE_URL_HERE}/api/v3/upload", tc)
+	client := NewClient(_client)
 
 	return client
 }

jpmontez avatar May 13 '21 19:05 jpmontez

Any chance of this being added? Would love to use this tool, but stuck on Enterprise.

nwsparks avatar Aug 17 '22 13:08 nwsparks

does it still no exit fot github enterprise?

CodeYogiCo avatar Oct 17 '22 13:10 CodeYogiCo

Closing as I'm no longer working at Gruntwork and this issue is stale. If someone would like to pick up this work, please open a new issue to discuss it with the team and propose a pull request.

zackproser avatar Jul 29 '23 22:07 zackproser