Jens Schauder
Jens Schauder

Reputation: 81862

How to configure Cloudbees Jenkins to trigger build on push to Github

I tried to follow the instructions in this article:

http://developer.cloudbees.com/bin/view/DEV/GitHub+Commit+Hooks+HOWTO

But I have two problems:

  1. It doesn't work. When I push to github nothing happens on the jenkins side. On Jenkins the GitHub Hook log says 'Polling has not run yet.'

  2. The possible cause for this is that I can't specify the git repository as described in this image:

enter image description here

There is no textfield for a public key, nor the other fields. Instead I have the fields

Repository URL, Name, Refspec

Also I can specify a http url (and everything but the triggering works). But if I specify the git/ssh url as in the image I get the following error:

Failed to connect to repository : Command "git ls-remote -h [email protected]:schauder/degraph.git HEAD" returned status code 128: stdout: stderr: Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I copied the url from github so a typo is somewhat unlikely.

I verified that I have the github plugin installed (upgraded to version 1.5)

Any hints how to fix or at least debug the problem?

Update answering questions in the comments:

Yes I checked the checkbox 'Build when a change is pushed to GitHub' in the job configuration.

And Yes I setup the webhook in GitHub. When I click the test button there, nothing happens. When I put the url from the webhook in my browser I get a http 500 saying

Not intended to be browsed interactively (must specify payload parameter)

Plus some lengthy stacktrace.

Another Update

I checked the GIT related plugins installed on the Jenkins side. Everything showing their with GIT in the text is installed and at the most current version

Upvotes: 2

Views: 5669

Answers (2)

Philip Johnson
Philip Johnson

Reputation: 1565

I've just published a tutorial on continuous integration for Play applications hosted on GitHub using CloudBees. This is intended to provide a comprehensive guide:

http://ics-software-engineering.github.io/play-example-continuous-integration/

Upvotes: 0

Benjamin Muschko
Benjamin Muschko

Reputation: 33426

Based on Git error message above, I assume you can't be authenticated. Did you add the CloudBees public SSH key on GitHub as described here?

Clarification by OP

The image referenced in the question seemed to suggest that one puts a public key from GitHub into CloudBees. But actually it is the other way round, and also all the labels seem to be changed, so it is kind of difficult to match that screenshot to what you see in CloudBees.

So what I did is this:

  • in the Job configuration at Cloudbees there is a Public Key (generated by CloudBee). I it in the CloudBees DEV@cloud Authorization section and labeled CloudBees Public Key. Copy that Key.

  • Hop over to GitHub and go to Settings > Deploy Keys. Add the key there.

  • go to Settings > Service Hooks > WebHook URLs. Click on the test button. You are not going to see much on the GitHub side.

  • Hop back to CloudBees Jenkins. From the main page of the job go to the ´GitHub Hook Log´. There you should see something like:

    Started on Mar 15, 2013 8:55:14 AM
    Using strategy: Default
    [poll] Last Built Revision: Revision 581acde89a62317fd8dabaa3f4c6025d1c9dd413     (origin/master)
    Fetching changes from the remote Git repositories
    Polling for changes in
    Done. Took 0.34 sec
    Changes found
    

    And your job should start.

    If the last line says No Changes this means the hook worked, but you already build the current version so the build is not triggered again.

  • If you still have problems, have look at https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin#GitHubPlugin-TriggerabuildwhenachangeispushedtoGitHub under 'trouble shooting' it tells you how to set up logging on the jenkins side. With this I get all kind of stuff in the Jenkins SystemLog.

Upvotes: 3

Related Questions