-
Notifications
You must be signed in to change notification settings - Fork 19
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
server api url is ignored - plugin still tries api.github.com #32
Comments
Are you using Access Token? |
No, I'm not using an access token. Just username and password. |
I'm seeing the same thing. I've had this issue on an older version of the plugin (~ 1.3?), but just decided to devote a few hours to trying to get it to work. I've updated to the latest versions of the dependent git/github API plugins to rule that out as an issue. I'll try it with a token and see if it works... |
Okay, yeah, it queried the right API endpoint once I put in the token, but oddly enough it seems to be defaulting to http instead of https in checkMergeable and that makes my transparent proxy sad:
|
BTW, if the Internet is interested, I generated my token using this awesome API call in curl:
|
Kohsuke's github api library I'm using doesn't support username:password based connection to enterprise servers. So you need to use access token with enterprise servers. |
@leftathome I think that the issue is the response from server contains wrong url.
you get
or
? Kohsuke's library is using the url it gets from the response. |
I switched to using tokens and I am working now. |
Where do the tokens go? I tried putting it in the password field on the configure page for Jenkins, but am getting the same error. Is it a problem that our user names are [username]@[domain].com and then in github we have just [username] shown? I.e. we log in with [username]@[domain].com and my repo is at [gitserver]/[username]/[repo]. I was having the same error as this issue so I got a token generated and now I am getting this error: |
In Jenkins / Manage Jenkins / System Configuration, under Github pull request builder, click the 'Advanced' button. The last field is for access token. |
Thank you so much for the quick reply, especially on a closed issue. I can't believe I didn't see that advanced button, d'oh! Now I am getting the following stack trace: |
my previous value for github server api url was https://[githubServer]/api/v3. I changed it to [githubServer]/api/v3 and the stack trace now complained about api.[githubServer] instead of api.https, so it looks like it still thinks it is a github web server instead of github enterprise. |
The url you're using looks correct to me. I'm using https://[github.my.org]/api/v3 for mine. |
Could it be that our github site's certificate is self-signed and not great? By that I mean I had to pass the -k option to curl in order to create my access token. Or is it the difference in usernames, i.e. login with [username]@[domain].com and repos are created at [githubServer]/[username]/[reponame]? I'm guessing the error thrown is wrong like it is when you try to use the username and password with no access token for a github enterprise server. |
For my github, we login with a non-email address login, i.e. something like 'myusername' and our repos are created in the same pattern as you mention. Can't weigh in on the self-signed cert though, as ours was issued by a CA. Hope that helps! |
Hey, I wanted to close the loop now that I got it working. I upgraded some of the git plugins like github api, github, ghprb, git and the like and the logging was improved so I got the below error which looked suspiciously like the self signed cert of my github enterprise was the problem and with some googling I found that I was right and this page provided an easy work around: http://www.erikzaadi.com/2011/09/09/connecting-jenkins-to-self-signed-certificated-servers/ Mar 20, 2013 8:07:25 AM org.jenkinsci.plugins.ghprb.GhprbRepo connect |
Settings are correct for github project url and server api url - both point to github enterprise server. Plugin still tries to use api.github.com:
Feb 20, 2013 10:50:27 PM org.jenkinsci.plugins.ghprb.GhprbRepo checkState
SEVERE: Could not retrieve repo named MyOrg/sandbox (Do you have properly set 'GitHub project' field in job configuration?)
java.io.IOException: {"message":"Bad credentials"}
at org.kohsuke.github.Requester.handleApiError(Requester.java:341)
at org.kohsuke.github.Requester._to(Requester.java:175)
at org.kohsuke.github.Requester.to(Requester.java:139)
at org.kohsuke.github.GitHub.getRepository(GitHub.java:250)
at org.jenkinsci.plugins.ghprb.GhprbRepo.checkState(GhprbRepo.java:78)
at org.jenkinsci.plugins.ghprb.GhprbRepo.check(GhprbRepo.java:91)
at org.jenkinsci.plugins.ghprb.GhprbTrigger.run(GhprbTrigger.java:132)
at hudson.triggers.Trigger.checkTriggers(Trigger.java:261)
at hudson.triggers.Trigger$Cron.doRun(Trigger.java:209)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/repos/MyOrg/sandbox
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at org.kohsuke.github.Requester.parse(Requester.java:297)
at org.kohsuke.github.Requester._to(Requester.java:173)
... 10 more
Feb 20, 2013 10:50:27 PM org.jenkinsci.plugins.ghprb.GhprbRepo checkState
SEVERE: Could not retrieve repo named MyOrg/sandbox (Do you have properly set GitHub project field in job configuration?)
The text was updated successfully, but these errors were encountered: