Error SOLVED: Thanks for pointing out the 404 became 401 - in my mind I was still treating the 401 as 404 and that's why my comments were not related to an authentication problem, but a URL/endpoint configuration problem - this is why my postman/curl was working but GoCD was reporting 40 because the config for the password/pat was wrong. As per my previous post I had changed to use personal access token (PAT) instead of password, but the RREADME is no very clear on the distinction between *accessToken *and *oauth *- I posted my configuration earlier and I was using accessToken. As soon as I changed it to *oauth *my 401 went away, so my current working config with GitHub Enterprise is:
endpoint=https://github/api/v3 login=build-user *oauth*=<pat:******************> Now, I can confirm I can successfully create a SCM for "Pull Requests Builder", however when creating SCM for "*Git Path Material Plugin*" I get error: *Check connection failed. Reason(s): ls-remote failed* [image: gocd-git-path-material-plugin-error.png] I can successfully run the git command on the GoCD server without error: git ls-remote git@github:devops/dev-utils.git Any ideas how to solve this one, please? Thanks in advance On Tuesday, 27 April 2021 at 17:12:13 UTC+1 [email protected] wrote: > On Tue, Apr 27, 2021 at 11:40 PM Sriram Narayanan <[email protected]> > wrote: > >> >> >> On Tue, Apr 27, 2021 at 9:51 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... >>> >> >> From the screenshot, it appears that you used the "devops" user to log in >> via Postman. The error in your earlier screenshot shows a 401 (which is >> "Requires Authentication" as per >> https://docs.github.com/en/rest/reference/repos#get-a-repository). >> > > I was looking earlier in the thread. Earlier a few days ago, you'd got a > 404. Now, you're getting a 401. It seems to me that you've got a password > related issue this time. > > >> Since you've shown that you are able to use the build-user to curl, could >> you check if the build-user's access token is correct in the ~/.github file? >> >> Similarly, could you check if you are able to use the devops user instead >> of build-user via GoCD? >> >> -- Ram >> >> >> >>> >>> 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> >>> . >>> >> -- 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/d1d14e4b-5ae6-4113-a28c-e27fe8d0ffafn%40googlegroups.com.
