Could you check what the Github Enterprise logs state when you try to connect via GoCD?
-- Ram On Tue, Apr 27, 2021 at 11:09 PM Emil <[email protected]> wrote: > I guess the only difference between the Enterprise setup and the public > GitHub is the difference in API url as described in the README: > > - for GitHub the API url is: https://api.github.com > - for Enterprise GitHub is: http://<hostname>/api/v3 > > and may be this difference might be the reason for a code bug explaining > this 401 error. > > In my postman screenshot above I am using basic authentication and you can > see it is inheriting the authentication from the root collection where this > request is sitting under, so to answer your question yes there is > authentication but I chose this way to hide the user/pat details. > > Please find attached the verbose output of the curl from the GoCD server > as requested. the log file does not have the json response, but I guess you > don't need it. Let me know if you need anything else. > Thanks, > Emil > > On Tuesday, 27 April 2021 at 15:09:34 UTC+1 [email protected] wrote: > >> I have never used a Github Enterprise setup before, but judging from the >> Postman output and the error you get on the Validation screen. Doesn't the >> API need any creds to access it? Because on the Postman I can see the owner >> as "devops" (not sure if it's the default user for unauthenticated >> requests)? >> >> Also can you share the output of cURL command with a -v from the GoCD >> Server machine? >> >> Thanks, >> >> On Tue, Apr 27, 2021 at 7:21 PM Emil <[email protected]> wrote: >> >>> Ashwanth, >>> >>> I have copied the url (https://github/api/v3/repos/devops/python-build) >>> from the 401 error message (reported in my earlier post) and I have >>> *successfully >>> hit *the GitHub API >>> <https://docs.github.com/en/[email protected]/rest/reference/repos#get-a-repository> >>> using postman & curl using the very same url reported by the error message: >>> [image: gocd-disprove-401.png] >>> >>> It looks like there is no issue with the URL and the 401 error is >>> misleading. I wonder if I have hit a configuration bug related to a private >>> GitHub instance... ?! >>> >>> I shall wait to hear your thoughts and if there are any other trouble >>> shooting steps I can take... >>> >>> Thanks again, >>> Emil >>> >>> On Tuesday, 27 April 2021 at 13:21:48 UTC+1 Emil wrote: >>> >>>> Hi Ashwanth, >>>> >>>> I appreciate your help and thanks for the great work on the plugin! >>>> >>>> I decided to start again from scratch re-configuring the plugin, hoping >>>> to get across something obvious that I have missed. I only changed the >>>> user/password with user/accessToken in the config. I got a CA cert error >>>> because out github instance uses self-signed certificate and after >>>> importing the cert to the java cacerts for both GoCD server and agent I got >>>> error: Check connection failed. Reason(s): check connection failed. Server >>>> returned HTTP response code: 401 for URL: >>>> https://github/api/v3/repos/devops/python-build >>>> [image: gocd-create-scm.png] >>>> >>>> The server log files (I hope these are the correct log files): >>>> >>>> - plugin-github.pr.status.log >>>> >>>> 2021-04-26 17:40:16,581 INFO [qtp1648030342-37] GitHubProvider:72 - >>>> Validating configuration >>>> 2021-04-26 17:43:59,552 INFO [qtp1648030342-30] GitHubProvider:72 - >>>> Validating configuration >>>> >>>> - plugin-git-path.log >>>> >>>> 2021-04-27 09:47:50,742 INFO [Thread-78] GitPathMaterialPlugin:72 - >>>> Loading GitPathMaterialPlugin... >>>> 2021-04-27 09:47:51,005 INFO [Thread-78] HelperFactory:82 - Command >>>> line git found [git version 2.31.1.windows.1] >>>> 2021-04-27 09:47:51,006 INFO [Thread-78] GitPathMaterialPlugin:82 - >>>> Type is CMD >>>> 2021-04-27 09:47:53,251 ERROR [Thread-78] JsonUtils:127 - >>>> go.plugin-settings.get-configuration failed >>>> 2021-04-27 09:47:53,292 ERROR [Thread-78] JsonUtils:127 - >>>> go.plugin-settings.get-view failed >>>> >>>> >>>> Here is the contents of my current ~/.github: >>>> >>>> endpoint=https://github/api/v3 >>>> login=build-user >>>> accessToken=<pat:******************> >>>> >>>> I couldn't find anything obvious apart from the git path config >>>> failure, could this be an issue? >>>> >>>> Thank you for your help in advance >>>> Emil >>>> >>>> >>>> On Tuesday, 27 April 2021 at 06:43:02 UTC+1 [email protected] wrote: >>>> >>>>> Emil, I'm one of the authors of the Plugin you're running into issue >>>>> with. On the README of the plugin, there would be a section >>>>> <https://github.com/ashwanthkumar/gocd-build-github-pull-requests#github> >>>>> on configuring the Github Enterprise Endpoint. I'm assuming you've done >>>>> that? >>>>> >>>>> If yes, can you please share some relevant sections of the plugin logs >>>>> that might also be helpful in finding what's going wrong. >>>>> >>>>> Thanks, >>>>> >>>>> On Mon, Apr 26, 2021 at 9:13 PM Emil <[email protected]> wrote: >>>>> >>>>>> Like you said, my call gets authenticated - I used HTTPS to test >>>>>> (used curl & postman) and I could get the same error with 404 "Not >>>>>> Found" >>>>>> response, but only if the endpoint/url is wrong - I could reproduce the >>>>>> error using curl and postman, but ONLY when I enter invalid url/api >>>>>> endpoint... >>>>>> >>>>>> The only issue I had to solve with the manual testing is I had to >>>>>> DISABLE the cert validation, because our github instance is using self >>>>>> signed certificate - but this will not explain when I use SSH in GoCD so >>>>>> I >>>>>> guess GoCD could be sending the request to invalid endpoint/url!? >>>>>> >>>>>> Next, I'll try to trace the request, but meanwhile please suggest >>>>>> should you have any other ideas... >>>>>> >>>>>> Thanks! >>>>>> >>>>>> On Monday, 26 April 2021 at 09:40:26 UTC+1 [email protected] wrote: >>>>>> >>>>>>> On Mon, Apr 26, 2021 at 4:08 PM Emil <[email protected]> wrote: >>>>>>> >>>>>>>> This is really odd if the connection is authenticated and it cannot >>>>>>>> find the repo... >>>>>>>> I have copied & pasted the URL from the actual repo. I am also >>>>>>>> using the very same URL a material and I am puzzled what I might be >>>>>>>> doing >>>>>>>> wrong!? >>>>>>>> It is internal Enterprise instance of GitHub and I am using SSH. My >>>>>>>> URL is simply this: *git@github:test-repo/python-build.git *where >>>>>>>> github >>>>>>>> is the hostname. >>>>>>>> >>>>>>>> For the configuration of the GitHub Pull Requests plugin I have >>>>>>>> added */api/v3/* to the hosname url as described in the >>>>>>>> documentation here >>>>>>>> <https://github.com/ashwanthkumar/gocd-build-github-pull-requests#github> >>>>>>>> - >>>>>>>> Is there something similar for the pluggable scm? >>>>>>>> >>>>>>> >>>>>>> Here's what the test suite checks for: >>>>>>> https://github.com/ashwanthkumar/gocd-build-github-pull-requests/blob/84b6e83478107dcb2d7e5452435e8c25a019be6d/src/test/java/in/ashwanthkumar/gocd/github/provider/github/GHUtilsTest.java#L11 >>>>>>> >>>>>>> You know, I'd responded earlier that the authentication had >>>>>>> succeeded after browsing the Github side code (via their library). Given >>>>>>> that you are using SSH, I'm not sure if Github is providing an >>>>>>> informative >>>>>>> response code. I suggest that you see which of the test cases you can >>>>>>> match >>>>>>> with as part of your tests. >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Thursday, 22 April 2021 at 14:54:05 UTC+1 [email protected] >>>>>>>> wrote: >>>>>>>> >>>>>>>>> On Thu, Apr 22, 2021 at 9:33 PM Emil <[email protected]> wrote: >>>>>>>>> >>>>>>>>>> Hi Folks, >>>>>>>>>> >>>>>>>>>> I am unable to *Create Pluggable SCM* with "Github Pull Requests >>>>>>>>>> Builder" because of the following error: >>>>>>>>>> Check connection failed. Reason(s): check connection failed. >>>>>>>>>> {"message":"Not Found","documentation_url":" >>>>>>>>>> https://docs.github.com/rest/reference/repos#get-a-repository"} >>>>>>>>>> >>>>>>>>> >>>>>>>>> This is a response returned by the Github instance: >>>>>>>>> https://docs.github.com/en/rest/reference/repos#get-a-repository >>>>>>>>> >>>>>>>>> Resource not found >>>>>>>>> >>>>>>>>> Status: 404 Not Found >>>>>>>>> >>>>>>>>> >>>>>>>>> Your credentials are correct ( hence it authenticated you). >>>>>>>>> >>>>>>>>> Could you check the URL for typos in the the repo name? >>>>>>>>> >>>>>>>>> Could you independently verify the existence of and access to the >>>>>>>>> repository via a web browser and/or via curl? >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> My Github is an Enterprise instance on the local network. I have >>>>>>>>>> also configured the "Github Pull Requests status notifier" just in >>>>>>>>>> case as >>>>>>>>>> I thought it could be related. >>>>>>>>>> >>>>>>>>>> Any ideas how can I troubleshoot this please? >>>>>>>>>> >>>>>>>>>> Thanks for your help! >>>>>>>>>> Emil >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>> Google Groups "go-cd" group. >>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>>> send an email to [email protected]. >>>>>>>>>> To view this discussion on the web visit >>>>>>>>>> https://groups.google.com/d/msgid/go-cd/fd6d53dd-d7b2-4f94-a64b-1b8e45f360b7n%40googlegroups.com >>>>>>>>>> <https://groups.google.com/d/msgid/go-cd/fd6d53dd-d7b2-4f94-a64b-1b8e45f360b7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>>>> . >>>>>>>>>> >>>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "go-cd" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> >>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/go-cd/46cf3160-95a4-4993-98e5-3de11047a720n%40googlegroups.com >>>>>>>> <https://groups.google.com/d/msgid/go-cd/46cf3160-95a4-4993-98e5-3de11047a720n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>> . >>>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "go-cd" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> >>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/go-cd/dd456fb4-48ed-40ea-a185-ffd0d3ffdfd7n%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/go-cd/dd456fb4-48ed-40ea-a185-ffd0d3ffdfd7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Ashwanth Kumar / ashwanthkumar.in >>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "go-cd" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/go-cd/8419783b-9b2f-4f05-a32d-acbd5f19a97bn%40googlegroups.com >>> <https://groups.google.com/d/msgid/go-cd/8419783b-9b2f-4f05-a32d-acbd5f19a97bn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> >> Ashwanth Kumar / ashwanthkumar.in >> >> -- > You received this message because you are subscribed to the Google Groups > "go-cd" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/go-cd/8c5c3fd5-8ed3-4750-a9e5-c922083b7626n%40googlegroups.com > <https://groups.google.com/d/msgid/go-cd/8c5c3fd5-8ed3-4750-a9e5-c922083b7626n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CANiY96bmo%3DK7C%2BwFiXHO470o2y2-UZ%2BYc58Lp2DqeGH6oSSEKA%40mail.gmail.com.
