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

Improper URL for GitHub Enterprise #178

Closed
morficus opened this issue Aug 8, 2014 · 37 comments
Closed

Improper URL for GitHub Enterprise #178

morficus opened this issue Aug 8, 2014 · 37 comments

Comments

@morficus
Copy link

morficus commented Aug 8, 2014

Jenkins version: 1.572
Plugin version: 1.13
Using GitHub Enterprise: yes

If you take a look at the log output below, there is a URL segment which is repeated (/api/v3/api/v3). This is causing the plugin to fail since that URL is not valid.

I have double-checked my config section, and I do have the URL properly defined (with this value: https://github.intenral.sw.com/api/v3/api/).

Created Pull Request #4 on morficus/test-repo by <morficus>  updated at: 8/8/14 12:03 AM SHA: 86ae0b203c036829d7606745babc30fae2fe7944
Aug 08, 2014 12:07:00 AM WARNING hudson.triggers.Trigger checkTriggers
org.jenkinsci.plugins.ghprb.GhprbTrigger.run() failed for hudson.model.FreeStyleProject@2b67d3c4[github-pr-test]
java.lang.Error: java.io.FileNotFoundException: https://github.intenral.sw.com/api/v3/api/v3/repos/morficus/test-repo/pulls/4/commits
    at org.kohsuke.github.Requester$1.fetch(Requester.java:304)
    at org.kohsuke.github.Requester$1.hasNext(Requester.java:271)
    at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
    at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
    at org.jenkinsci.plugins.ghprb.GhprbPullRequest.tryBuild(GhprbPullRequest.java:178)
    at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:114)
    at org.jenkinsci.plugins.ghprb.GhprbRepository.check(GhprbRepository.java:114)
    at org.jenkinsci.plugins.ghprb.GhprbRepository.check(GhprbRepository.java:95)
    at org.jenkinsci.plugins.ghprb.Ghprb.run(Ghprb.java:95)
    at org.jenkinsci.plugins.ghprb.GhprbTrigger.run(GhprbTrigger.java:132)
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:266)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:214)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)
Caused by: java.io.FileNotFoundException: https://github.internal.sw.com/api/v3/api/v3/repos/morficus/test-repo/pulls/4/commits
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.kohsuke.github.Requester.parse(Requester.java:359)
    at org.kohsuke.github.Requester.access$300(Requester.java:59)
    at org.kohsuke.github.Requester$1.fetch(Requester.java:295)
    ... 20 more
@gshively11
Copy link

We're also getting this.
Jenkins: 1.554.3
GHPRB: 1.13-1

@highlycaffeinated
Copy link

Same problem here:
Jenkins ver. 1.566
GHPRB: 1.13

@jedesah
Copy link

jedesah commented Aug 14, 2014

+1

@morficus
Copy link
Author

The same issue is open on the official bug tracker as well: https://issues.jenkins-ci.org/browse/JENKINS-24145

@fordsm
Copy link

fordsm commented Aug 15, 2014

+1

1 similar comment
@natewarr
Copy link

+1

@morficus
Copy link
Author

@DavidTanner was this one of the bugs you address between 1.14 - 1.14-3?

@DavidTanner
Copy link
Collaborator

I have not yet, but i will see about doing that today.
On Aug 18, 2014 9:20 PM, "Maurice Williams" notifications@github.com
wrote:

@DavidTanner https://github.com/DavidTanner was this one of the bugs
you address between 1.14 - 1.14-3?

Reply to this email directly or view it on GitHub
#178 (comment).

@DavidTanner
Copy link
Collaborator

The URL you are using is invalid, it should be /api/v3 I don't see anywhere that anything is being appended. The only other time I see where it says file not found is if you don't have an API key setup for the plugin.

@natewarr
Copy link

I have reproduced the problem in the debugger too using my GitHub Enterprise. The trouble seems to be in pr.listCommits() in https://github.com/jenkinsci/ghprb-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java#L219. That method is of course in the GHPullRequest class which is outside of the plugin.

Follow the rabbit, and it gets you to https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GitHub.java#L231 where our apiUrl = "https://github.mysite.com/api/v3" is combined with tailApiUrl="/api/v3/repos/myrepo/myapp/pulls/7/commits".

I hope this helps. I'm not sure whether the bug is in the API or in the plugin or whether there's a workaround.

@fordsm
Copy link

fordsm commented Aug 19, 2014

This is what I have configure for GitHub server api URL:
https://github.lifeway.org/api/v3/

This is from my Jenkins log:

Aug 19, 2014 5:33:00 AM WARNING hudson.triggers.Trigger checkTriggers

org.jenkinsci.plugins.ghprb.GhprbTrigger.run() failed for
hudson.model.FreeStyleProject@197a114e[TargetingService]
java.lang.Error: java.io.FileNotFoundException:
https://github.lifeway.org/api/v3/api/v3/repos/sford/TargetingService/pulls/1/commits

Where would the extra /api/v3 be coming from?

On Tue, Aug 19, 2014 at 12:22 PM, David Tanner notifications@github.com
wrote:

The URL you are using is invalid, it should be /api/v3 I don't see
anywhere that anything is being appended. The only other time I see where
it says file not found is if you don't have an API key setup for the plugin.


Reply to this email directly or view it on GitHub
#178 (comment).

@DavidTanner
Copy link
Collaborator

The extra /api/v3 is coming in when GHPullRequest line 199 creates just the path and sends it down the rabbit hole, where GitHub.java line 231 sees it is just the path and appends it to the main apiurl.

Since the list commits is new, I am going to say it is at fault. I can add a workaround to the plugin till it is fixed, or we just create the bug against the github project and wait for the patch.

I am good with either one, but I do know how I would fix it if nobody wants to wait.

@DavidTanner
Copy link
Collaborator

Created hub4j/github-api#116 for github-api

@natewarr
Copy link

Thanks, @DavidTanner.

@morficus
Copy link
Author

@DavidTanner yeah seriously, thanks for the quick turn around on that 👍

@makii42
Copy link

makii42 commented Aug 20, 2014

👍

@DavidTanner
Copy link
Collaborator

I added a try-catch in version 1.14-5 that will fix this issue. Hopefully they release the fix in github-api, but for now this will suffice.

@timbuchwaldt
Copy link

Running 1.14-5 I can tell you the Bug still exists (at least I still get the warning for /api/v3/api/v3). Is there any work-arround for me now?

@DavidTanner
Copy link
Collaborator

The error will be printed, but it shouldn't mark the job as failed. Can
you send me the stack trace?

On Thu, Aug 21, 2014 at 12:20 PM, Tim Buchwaldt notifications@github.com
wrote:

Running 1.14-5 I can tell you the Bug still exists (at least I still get
the warning for /api/v3/api/v3). Is there any work-arround for me now?

Reply to this email directly or view it on GitHub
#178 (comment).

David Tanner

3 Nephi 5:13 http://lds.org/scriptures/bofm/3-ne/5.13?lang=eng#12 Behold,
I am a disciple of Jesus Christ, the Son of God. I have been called of him
to declare his word among his people, that they might have everlasting life.

@timbuchwaldt
Copy link

It doesn't fetch the new PRs as it seems (I use the scheduled fetch, not the HTTP hooks).

Tim

On 21.08.2014, at 21:10, David Tanner notifications@github.com wrote:

The error will be printed, but it shouldn't mark the job as failed. Can
you send me the stack trace?

On Thu, Aug 21, 2014 at 12:20 PM, Tim Buchwaldt notifications@github.com
wrote:

Running 1.14-5 I can tell you the Bug still exists (at least I still get
the warning for /api/v3/api/v3). Is there any work-arround for me now?

Reply to this email directly or view it on GitHub
#178 (comment).

David Tanner

3 Nephi 5:13 http://lds.org/scriptures/bofm/3-ne/5.13?lang=eng#12 Behold,
I am a disciple of Jesus Christ, the Son of God. I have been called of him
to declare his word among his people, that they might have everlasting life.

Reply to this email directly or view it on GitHub.

@DavidTanner
Copy link
Collaborator

I am also using the cron instead of hooks, but I am using github.com I don't understand what your error is exactly. I assumed the FileNotFound exception could be caught and ignored in PullRequest. Do you have more information on what you are seeing?

@timbuchwaldt
Copy link

Hey,
so the exact log is (except for the domain):

Aug 21, 2014 10:01:00 PM WARNING hudson.triggers.Trigger checkTriggers org.jenkinsci.plugins.ghprb.GhprbTrigger.run() failed for hudson.model.FreeStyleProject@5b01522c[API] java.lang.Error: java.io.FileNotFoundException: https://github.mysecretcompany.de/api/v3/api/v3/repos/migros/facade/pulls/3/commits at org.kohsuke.github.Requester$1.fetch(Requester.java:304) at org.kohsuke.github.Requester$1.hasNext(Requester.java:271) at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44) at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32) at org.jenkinsci.plugins.ghprb.GhprbPullRequest.tryBuild(GhprbPullRequest.java:220) at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:155) at org.jenkinsci.plugins.ghprb.GhprbRepository.check(GhprbRepository.java:113) at org.jenkinsci.plugins.ghprb.GhprbRepository.check(GhprbRepository.java:94) at org.jenkinsci.plugins.ghprb.Ghprb.run(Ghprb.java:92) at org.jenkinsci.plugins.ghprb.GhprbTrigger.run(GhprbTrigger.java:135) at hudson.triggers.Trigger.checkTriggers(Trigger.java:266) at hudson.triggers.Trigger$Cron.doRun(Trigger.java:214) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.FileNotFoundException: https://github.mysecretcompany.de/api/v3/api/v3/repos/migros/facade/pulls/3/commits at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at org.kohsuke.github.Requester.parse(Requester.java:359) at org.kohsuke.github.Requester.access$300(Requester.java:59) at org.kohsuke.github.Requester$1.fetch(Requester.java:295) ... 19 more

The Github-Hostname is set to https://github.mysecretcompany.de/api/v3

The Github Hook Log for this build says Polling has not run yet.

@DavidTanner
Copy link
Collaborator

FileNotFoundException should be caught by the catch statement. I am not sure why this is happening still. If it can't be caught, then we will just have to wait for them to fix it on their end. I am sorry.

@gshively11
Copy link

I think this issue should be re-opened, even if the bug is caused by the dependency on the github api plugin - the end result is the same. All us enterprise github users want our pull request plugin back and open issues get more visibility on the problem!

@jmreicha
Copy link

I am receiving a similar error - although I am not using enterprise githubt - I just have my github api set to https://api.github.com.

Here is the error:

Aug 27, 2014 10:25:00 PM WARNING hudson.triggers.Trigger checkTriggers
org.jenkinsci.plugins.ghprb.GhprbTrigger.run() failed for hudson.model.FreeStyleProject@6e397c84[Master]
java.lang.NullPointerException
    at org.jenkinsci.plugins.ghprb.GhprbTrigger.run(GhprbTrigger.java:135)
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:266)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:214)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)

Any thoughts?

@morficus
Copy link
Author

Now that the PR over on the github-api repo has been merged in, does anything extra have to do done for this plugin to pickup the new version? I'm hoping nothing more than a uninstall + reinstall is needed.

@DavidTanner
Copy link
Collaborator

The if statement i added needs to be removed, i will change the code and
dependency Monday.
On Aug 30, 2014 2:58 PM, "Maurice Williams" notifications@github.com
wrote:

Now that the PR over on the github-api repo has been merged in, does
anything extra have to do done for this plugin to pickup the new version?
I'm hoping nothing more than a uninstall + reinstall is needed.

Reply to this email directly or view it on GitHub
#178 (comment).

@morficus
Copy link
Author

👍


Maurice W.

Sent from a mobile device. Please forgive any typos.
On Aug 30, 2014 5:26 PM, "David Tanner" notifications@github.com wrote:

The if statement i added needs to be removed, i will change the code and
dependency Monday.
On Aug 30, 2014 2:58 PM, "Maurice Williams" notifications@github.com
wrote:

Now that the PR over on the github-api repo has been merged in, does
anything extra have to do done for this plugin to pickup the new version?
I'm hoping nothing more than a uninstall + reinstall is needed.

Reply to this email directly or view it on GitHub
#178 (comment).


Reply to this email directly or view it on GitHub
#178 (comment).

@DavidTanner
Copy link
Collaborator

Anyone experiencing this bug still?

@eduacsp
Copy link

eduacsp commented Nov 16, 2014

i get this error:

java.io.FileNotFoundException: https://github.com/eduacsp/pm-75-leiloes.git/user
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at org.kohsuke.github.Requester.parse(Requester.java:383)
at org.kohsuke.github.Requester._to(Requester.java:185)
at org.kohsuke.github.Requester.to(Requester.java:160)
at org.kohsuke.github.GitHub.getMyself(GitHub.java:249)
at org.kohsuke.github.GitHub.(GitHub.java:126)
at org.kohsuke.github.GitHubBuilder.build(GitHubBuilder.java:66)
at org.kohsuke.github.GitHub.connectToEnterprise(GitHub.java:146)
at com.cloudbees.jenkins.Credential$DescriptorImpl.doValidate(Credential.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

@DavidTanner
Copy link
Collaborator

Remove the .git portion of the url

@eduacsp
Copy link

eduacsp commented Nov 16, 2014

I did, but it doesnt work at all. I think, the problem is '/user' portion:

java.io.FileNotFoundException: https://github.com/eduacsp/pm-75-leiloes/user

@DavidTanner
Copy link
Collaborator

You need to have api.github.com also.

@DavidTanner
Copy link
Collaborator

Check the readme to make sure the api url is correct in all locations. The setting globally isnt supposed to point directly to any project, just api.github.com

@eduacsp
Copy link

eduacsp commented Nov 16, 2014

This is my configuration:
Override Hook URL: https://github.com/eduacsp/pm-75-leiloes.git
API URL: https://api.github.com/eduacsp
Username: eduacsp
Password: ********

I get this error:
java.io.IOException: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
at org.kohsuke.github.Requester.handleApiError(Requester.java:427)
at org.kohsuke.github.Requester._to(Requester.java:206)
at org.kohsuke.github.Requester.to(Requester.java:160)
at org.kohsuke.github.GitHub.getMyself(GitHub.java:249)

@DavidTanner
Copy link
Collaborator

The api url needs to be just https://api.github.com

@eduacsp
Copy link

eduacsp commented Nov 16, 2014

Thx!..works fine now

DavidTanner added a commit that referenced this issue Sep 22, 2015
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

No branches or pull requests