Pix4D / cogito

Concourse resource for GitHub Commit Status and Google Chat notifications
MIT License
34 stars 14 forks source link

Support for Enterprise Github? #51

Closed olwenya closed 1 year ago

olwenya commented 3 years ago

Does this line mean that for Enterprise Github (not github.com) will now work?

https://github.com/Pix4D/cogito/blob/50a9d9656fed99e13f7c83fc3487e3c3500ef687/resource/resource.go#L378

fetching pix4d/cogito@sha256:cef4adfe17e9ee5f7c16a4094e435d88857f663f080507dcb6b61e7390b52852
29291e31a76a [==========================================] 2.7MiB/2.7MiB
ff9cc595764e [======================================] 274.7KiB/274.7KiB
60eff1c2ce14 [==============================================] 116b/116b
507e2309724c [==========================================] 5.9MiB/5.9MiB
This is the Cogito GitHub status resource. Tag: 0.6.0, commit: 5d34381a18, build date: 2021-08-26
resource source configuration and git repository are incompatible.
Git remote: "https://notgithub.com/xxx/xxx.git"
Resource config: host: github.com, owner: "xxx", repo: "xxx". wrong git remote
marco-m-pix4d commented 3 years ago

Hello, I don't know how Enterprise Github works. The check at line 378 is there because this resource uses the GitHub API, so the repo must be hosted on GitHub. Is there a way to know if a repo is hosted on enterprise Github?

olwenya commented 3 years ago

@marco-m-pix4d Github Enterprise is just github hosted on enterprise servers (onprem or private cloud), for companies etc. So the host in some cases might not be github.com eg. github.mycompany.org.

All the features of github are available.

In other words, what I would like is the option to override the default host from github.com to something else, so that the api call points to our own domain.

marco-m-pix4d commented 2 years ago

Looking into this, there are two parts involved:

marco-m-pix4d commented 2 years ago

@olwenya could you please confirm that the only difference is the {hostname}, both to access the API and to refer to the git remote ? See https://github.com/Pix4D/cogito/issues/51#issuecomment-1012300930

wanderanimrod commented 2 years ago

@olwenya could you please confirm that the only difference is the {hostname}, both to access the API and to refer to the git remote ? See https://github.com/Pix4D/cogito/issues/51#issuecomment-1012300930

@marco-m-pix4d , this is correct.

wanderanimrod commented 2 years ago

@marco-m-pix4d , FYI I cloned this repo, replaced all the github.com references with our enterprise GitHub domain, built an image and tested it. It worked! I haven't pushed the changes to my fork because the tests are broken, and I need to parameterize the GH host instead of hard coding it in.

Do you think the host should become another config option on the resource's source (defaulting to github.com)?