1
0
mirror of https://github.com/gryf/ferrit.git synced 2026-02-07 08:45:53 +01:00
Files
ferrit/README.rst

3.7 KiB

Ferrit

Ferrit is a fake Gerrit server implementation created for functional testing of events in Jenkins & Gerrit Trigger ecosystem.


Architecture

Ferrit consists of two servers, http and ssh.

We relay on real Jenkins installation, so it has to be configured up front. See next section for details.

Having Jenkins up and running, we can simultaneously run ssh and http servers by invoking:

$ ferrit

To trigger the build initiated by gerrit fake server, use the curl utility to send appropriate data to jenkins server:

$ curl -d 'project=example&branch=master&type=patchset-created' \
  http://localhost:8181/make/event

With this command, we tell ferrit http server, to prepare right payload with project set to example, branch set to master and type of the event to patchset-created. This will build a json-like structure and send it through the fifo queue to the SSH server, which will be catch by jenkins, who is listing to the events. If the project and branch match, appropriate job will be executed.

Installation

Jenkins

We are referring to Jenkins here but it might be any kind of CI system who is willing to react on certain events, gerrit server could provide.

In case of Jenkins, we assume that at least gerrit trigger plugin is installed within, and there are jobs which are properly configured to be triggered by such event.

SSH keys

For both - jenkins and ferrit server, you'll need ssh key. To generate it for paramiko is a bit tricky, depending which version of openssh you have installed.

For versions prior to 7.8, it is enough to issue a command:

$ ssh-keygen -f gerrit-server-key

but for 7.8 and up:

$ ssh-keygen -f gerrit-server-key -m pem

Jenkins needs to have a key to access ferrit server. So there is a need for generating two pair keys one pair for the server, one for the client - Jenkins or any other CI system.

Python

Ferrit modules are written in Python and depends on two external libraries:

Installation is as easy as issuing command:

$ pip install .

in root of this repository. You can use virtualenv for your convenience. All dependencies will be installed automatically.

Please note, Python 2.x is not supported.


Ferrite image by Karl-Martin Skontorp is on Attribution 2.0 Generic (CC BY 2.0) license.