Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Gerrit- trigger plugin in Jenkins works?

I am trying to understand how does the gerrit-trigger in Jenkins works in details? Also, how is the test for the triggered cose is being invoked ?

Thanks,

like image 933
moe312 Avatar asked Apr 19 '13 14:04

moe312


People also ask

How Jenkins works with Gerrit?

To achieve this, a Jenkins job is configured to clone the changes from Gerrit, analyze the project with CodeChecker and publish (as comments in Gerrit) the issues found in the changed files. Based on the result of the analysis, the job also sets the Code-Review and Verify labels in Gerrit Review.

What is Gerrit trigger plugin?

This plugin integrates Jenkins to Gerrit code review for triggering builds when a "patch set" is created.

What is Gerrit trigger?

As a Code Stream administrator or developer, you can integrate Code Stream with the Gerrit code review life cycle by using the Gerrit trigger. The event triggers a pipeline to run when you create a patch set, publish drafts, merge code changes on the Gerrit project, or directly push changes on the Git branch.


1 Answers

The gerrit trigger works like this:

  1. It connects to the gerrit server using ssh and uses the gerrit stream-events command

  2. It then watches this stream as the data comes in

  3. It will try to match the events to triggers that have defined in your projects

Potential pit-falls:

  1. Jenkins user has improper ssh credentials

  2. Jenkins user does not have the stream-events rights

How to check:

  1. Login as jenkins user

  2. ssh -p 29418 [email protected] gerrit stream-events

  3. Push a commit to the server and you should see things on your stream

Problems:

  1. ssh connection failed? setup you ssh key pair

  2. No streaming right? Go to the All-Projects->Access and under Global Capabilities add Stream Events to the Non-Interactive Users group

like image 161
uncletall Avatar answered Oct 24 '22 10:10

uncletall