Gerrit Plugin

Plugin Information

Plugin ID gerrit
Latest Release 0.7
Latest Release Date Oct 20, 2010
Sources Github
Support Eclipse Hudson Forum
Issue Tracking Eclipse Bugzilla

You might want to check Gerrit Trigger also. See http://hudson.361315.n4.nabble.com/We-would-like-to-contribute-a-new-Gerrit-plugin-td2224606.html#a2224606 for information about main differences.

This plugin integrates Gerrit Code Review to Hudson.

It will mark a change verified if the build of the change was successful, effectively implementing a pre-tested commit workflow with Gerrit and the Git plugin (0.8.2 or later)

After build, the plugin just checks what revision is in workspace at the moment and uses Gerrits ssh command line tools for marking the result.

Getting Started

Using the latest release of the Gerrit plugin, along with recent builds of Gerrit itself are recommended. Thanks to a recent addition to Gerrit, one can now create "role accounts" such as one for the Hudson <-> Gerrit integration.

Pre-requisites
  1. Generate an SSH key for the Hudson user, the private key will need to be placed on the Hudson master node.
  2. Create a "hudson" user in Gerrit: cat hudson.pub | ssh gerrithost gerrit create-account --ssh-key - --full-name Hudson hudson
  3. I recommend creating a group specifically for role accounts (such as "Bots" in the Admin > Groups interface in Gerrit)
  4. It is also useful to set up git-daemon(1) on the machine running Gerrit to allow your Hudson slaves anonymous access to the repository, otherwise you'll need to set up all the slaves that will be running your Gerrit-enabled jobs with SSH access.
Creating the Job
  1. Create a new job, adding your Git repository. Change the Refspec field to reference +refs/changes/*:refs/remotes/origin/* instead of +refs/heads/*:refs/remotes/origin/*. Also, make sure you have chosen the "Gerrit-Plugin" choosing strategy, NOT "Gerrit" as in the image below (Choosing strategy was moved from Git-plugin to Gerrit-plugin and the name haed to be changed).
  2. Add your build steps as per usual
  3. Check the "Gerrit Integration" checkbox in the Post-build Actions section.
  4. Build!
  5. Once you're certain your job is configured correctly, visit Gerrit and grant the "hudson" account's group (i.e. "Bots") "+1 Verified" access to all projects, so it can annotate the changes with +1 or -1.

Versions

0.7
0.6
  • Aborted builds won't be marked as failed anymore
0.5
  • Moved buildchooser from git-plugin, use "Gerrit-Plugin" choosing strategy from now on.
  • Fix for issue when using Cygwin+Git.
0.4 2010-04-08
  • Fixed issue when using slaves for build
  • SSH commands are now sent from master only.
0.3 2010-04-06
  • Internal restructuring
  • Added some unit tests
  • This version will lose settings when upgrading from 0.2*
0.2 2010-03-30
  • Close ssh connection to gerrit properly
  • Added configuration option for unstable build verify value.
0.1.1
  • Failed release process forced to do a new release
0.1
  • Initial version

TODO

Settings

Basic settings for plugin, remember to add user into gerrit.

Settings for Git -plugin (Available in 0.8.2)

How Hudson shows up in gerrit

Review matrix:

Comment field:

Labels:

plugin-external plugin-external Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 17, 2010

    Antony Stubbs says:

    It seems the create-account command doesn't exist anymore? xxxxxxxxx-xxxxxx-xxx...

    It seems the create-account command doesn't exist anymore?

    xxxxxxxxx-xxxxxx-xxxxxx-xxxx-4:temp xxxxxxxxxxxxxxxxx$ cat hudson.pub | ssh -p xxxxx xxxx.xxx gerrit create-account --ssh-key - --full-name Hudson hudson
    gerrit: create-account: not found

    Powered by Gerrit Code Review (2.1.2.4)

    And another comment: http://groups.google.com/group/repo-discuss/browse_thread/thread/d1dde14765c10799/08999d2d8ec04776?lnk=gst&q=create-account#08999d2d8ec04776

    1. Jun 17, 2010

      Antony Stubbs says:

      My bad. The command just doesn't exist in the version I'm using (2.1.2.4) - it o...

      My bad. The command just doesn't exist in the version I'm using (2.1.2.4) - it only appears to be in the 2.1.3 versions.

  2. Oct 22, 2010

    Patrick Renaud says:

    I would gladly start using 0.7 if only I knew what changes it introduces . Can ...

    I would gladly start using 0.7 if only I knew what changes it introduces . Can you please add text in the Version History section for this release?

    Tx.

    1. Oct 26, 2010

      Jyrki Puttonen says:

      Yep, of course. I had problems with logging in and even username/password email ...

      Yep, of course. I had problems with logging in and even username/password email reminders didn't work.