No description, website, or topics provided.
Clone or download
zaro0508 Merge pull request #4 from bpedersen2/manual
Skip reporting on manually triggered build
Latest commit 717d577 Dec 2, 2016

README.md

Overview

The Jenkins Gerrit Verify Status Reporter plugin allows Jenkins to publish test reports to Gerrit instances that are using the Gerrit verify-status plugin.

Reqiurements

Quick Start Guide

This is a quick start guide on how to quickly install and configure Gerrit and Jenkins so that Jenkins can report job results to Gerrit.

NOTE: This Guide is meant for the impatient hacker who doesn't want to read an endless streams of documentation and the developers who do don't want to write it :)

Gerrit Verify Status Plugin

Setup database

  • Setup database connection info in gerrit.config
[plugin "verify-status"]
  dbType = h2
  database = /home/joe/gerrit_testsite/db/CiDB

NOTE: If you prefer to run without prompts add the --batch flag.

Setup the Gerrit user

  • Start Gerrit
  • Create a Gerrit user (i.e. 'Jenkins') to allow the jenkins to connect to it.
  • Add the 'Jenkins' user to the 'Non-Interactive Users' group.
Gerrit -> People -> List Groups -> Non-Interactive Users
Add 'Jenkins' user to the group
Projects -> List -> All-Projects -> Access
Edit
Global Capabilities -> Add Permission ->  Save Verification Report -> Add Group
Allow: Non-Interactive Users
Global Capabilities -> Add Permission ->  Stream Events -> Add Group
Allow: Non-Interactive Users
Save settings
  • Create an http password for the 'Jenkins' user.
Login as the Jenkins user
Settings -> HTTP Password -> Generate Password

Gerrit Verify Status Reporter Plugin

Install

  • Install the Jenkins Gerrit trigger plugin using the Jenkins plugin manager.
  • Install the Jenkins gerrit-verify-status-reporter plugin
  • Configure the Gerrit trigger global config to connect to a Gerrit instance.
Jenkins -> Manage Jenkins -> Gerrit Trigger
  • Configure it to use the Gerrit Rest API. The config is under the 'Advanced' setting. Enter the http password from Setup the Gerrit User section.
  • Configure Jenkins Global configuration to enable environment variables.
Jenkins -> Manage Jenkins -> Configure System -> Global properties
Enable Environment variables
Save settings

Setup Job

Note: The job abstain and value data are automatically determined:

  • abstain is true if the Gerrit Trigger is set to SilentMode or any SkipVote parameter is enable.
  • value is set to +1 for pass, -1 for fail and 0 for unstable result.

Testing

  • Login into Gerrit with any user.
  • View any patchset.
  • Reply to a patchset with a 'recheck' comment (this should auotmatically kick off a jenkins build).
  • After Jenkins has completed running the build it will send a verification report to Gerrit.
  • The report should now appear on the Gerrit UI (under the Code-Review label).

Debugging

  • Check the Gerrit logs and Jenkins logs to see if there are any errors
  • Communication between Gerrit and Jenkins are done using SSH and REST APIs so make sure the security is setup so that one server can communicate with the other.
  • Use the ssh gsql command to see if any test results are in the database.