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

organizations don't work #12

Closed
davidszotten opened this issue Oct 3, 2012 · 22 comments
Closed

organizations don't work #12

davidszotten opened this issue Oct 3, 2012 · 22 comments

Comments

@davidszotten
Copy link

having an issue getting the bot to build pull requests for my organization. the bot was in a team that had the proper access, but didn't even detect pull requests.

forking the repo to a regular user and making the bot a "collaborator" (and changing nothing but the username in the repo url in jenkins) it worked fine

is this a known problem?

@cloudbring
Copy link

I have been having this same issue. Firstly, the jenkins user has to be an admin to access the Github APIs in question it needs. I've verified this manually.

Secondly, there is an issue with private repos that seems to be resolved but, I'm having trouble using.

@davidszotten
Copy link
Author

so after the latest update to the github plugin jenkins can now pull down the code. jenkins isn't a collaborator on the repo (don't want to give it push access) but i've added an api token that has (verified) access to write status updates.

@mpsingh01
Copy link

Same here. It does not work for Organizations. Was anyone able to get it working?

@djspiewak
Copy link

Same problem. It looks like the getRepository call in the GitHub API is consistently returning null.

@hjr3
Copy link
Contributor

hjr3 commented Oct 20, 2012

@cloudbring I don't think the bot user needs to have admin access for this to work.

I have manual builds working on for a private organization repo when specifying a sha1 build parameter. I can get it to trigger sometimes, but not consistently. I am looking into it.

The biggest problem is that there is no polling log that shows what the plugin is doing each time it looks for new PR's to build. This makes it very hard to ensure that job has been setup properly.

Things to check:

  1. The Github project url has been specified. This is not the repo url, but the url you would paste into your browser to view the page on github.
  2. The author of the pull request is in the in the Whitelist of the job.

@janinko
Copy link
Owner

janinko commented Oct 20, 2012

@djspiewak I've took quick look at the github-api and found that there could be problem with organizations. I'll try to investigate more.

@hjr3
Copy link
Contributor

hjr3 commented Oct 20, 2012

I can now consistently build private organization repositories with no problems. If anyone is having problems with triggering builds, please check the following:

  1. Follow the README instructions exactly. Some values seem unnecessary, but can cause the plugin to fail. Example: Prevent NullPointerException due to missing url #16
  2. Tail /var/log/jenkins/jenkins.log and make sure no there are no strack traces. Issues like SSL Certificate error when build is triggered #17 can prevent the plugin from polling the repository.
  3. The plugin has not already stored the updated date of the PR. You can check this by opening /var/lib/jenkins/org.jenkinsci.plugins.ghprb.GhprbTrigger.xml and looking at what entries have been recorded for each job. Entries do not get removed if you delete a job from jenkins. You can safely edit this file and remove everything between the <map> ... </map> tags. This will "reset" the job and existing, open PR's should get built.

@djspiewak
Copy link

I'm still having issues with private organization repos. Basically, I'm getting the same issue as in #15, but recreating the build doesn't resolve the problem. I've tried both using a (known good) access token, as well as a username/password.

@hjr3
Copy link
Contributor

hjr3 commented Oct 24, 2012

@djspiewak Are you including the username and password in the repository URL?

@djspiewak
Copy link

I am not.

@janinko
Copy link
Owner

janinko commented Nov 6, 2012

I can't reproduce this issue. I have organization with private repository and pullrequest waiting. My bot has Push & Pull access to this repository and it works fine for me.

@hjr3
Copy link
Contributor

hjr3 commented Nov 6, 2012

@janinko Does the bot need Push and Pull access? I think most people assume that the bot only needs Pull access.

@janinko
Copy link
Owner

janinko commented Nov 7, 2012

The bot needs Push access to be able to update commit status.

@hjr3
Copy link
Contributor

hjr3 commented Nov 7, 2012

I am not comfortable giving the bot push access to the repo. I will do some investigation to see if repo:status oAuth scope will be enough to make it work.

@bendavies
Copy link

My bot has pull access, is using an oauth token with this plugin, with repo and repo:status scopes.
I receive this in my log:

08-Nov-2012 17:41:15 org.jenkinsci.plugins.ghprb.GhprbRepo createCommitStatus
SEVERE: Could not update commit status of the Pull Request on Github.
java.io.FileNotFoundException: https://api.github.com/repos/{hidden}?access_token={hidden}
    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:293)
    at org.kohsuke.github.Requester._to(Requester.java:169)
    at org.kohsuke.github.Requester.to(Requester.java:135)
    at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:486)
    at org.jenkinsci.plugins.ghprb.GhprbRepo.createCommitStatus(GhprbRepo.java:120)
    at org.jenkinsci.plugins.ghprb.GhprbRepo.createCommitStatus(GhprbRepo.java:114)
    at org.jenkinsci.plugins.ghprb.GhprbBuild.check(GhprbBuild.java:35)
    at org.jenkinsci.plugins.ghprb.GhprbRepo.checkBuilds(GhprbRepo.java:105)
    at org.jenkinsci.plugins.ghprb.GhprbRepo.check(GhprbRepo.java:90)
    at org.jenkinsci.plugins.ghprb.GhprbTrigger.run(GhprbTrigger.java:104)
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:259)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:207)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
    at java.util.TimerThread.mainLoop(Timer.java:534)
    at java.util.TimerThread.run(Timer.java:484)

Hitting the url manually, in a browser, works.

@hjr3
Copy link
Contributor

hjr3 commented Nov 8, 2012

@bendavies Yes, I just saw this too ; / We probably have to patch the github API plugin to play better with oAuth.

@bendavies
Copy link

@hradtke i've replicated this locally. The POST to create a status (http://developer.github.com/v3/repos/statuses/) doesn't work.
I've contacted github for some support, to find out what I'm doing wrong.

@bendavies
Copy link

Update from Github.
The team that the bot is in must have pull and push status, as someone said above.
the OAuth scope 'repo:status' is not sufficient.

This can be closed.

@hjr3
Copy link
Contributor

hjr3 commented Nov 12, 2012

I didn't think the travis-CI bot had push access to repositories to set the commit status.

@bendavies
Copy link

@hradtke I am specifically talking about a user in a team, in organisations, on private repositories. Github confirmed that is the case to me, and they have updated the docs accordingly.
It will be different for public repos/travis.

@hjr3
Copy link
Contributor

hjr3 commented Nov 12, 2012

I am talking about Travis PRO, which works for private repos.

@bendavies
Copy link

fair enough. I'm just going on what github told me.

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

7 participants