summaryrefslogtreecommitdiff
path: root/doc/source/quick-start.rst
blob: 6d16c92a69bbd1a56a5bf67dbcf64b168bd81e2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
Quick Start Guide
=================

System Requirements
-------------------

For most deployments zuul only needs 1-2GB. OpenStack uses a 30GB setup.

Install Zuul
------------

You can get zuul from pypi via::

    pip install zuul

Zuul Components
---------------

Zuul provides the following components:

    - **zuul-server**: scheduler daemon which communicates with Gerrit and
      Gearman. Handles receiving events, executing jobs, collecting results
      and postingreports.
    - **zuul-merger**: speculative-merger which communicates with Gearman.
      Prepares Git repositories for jobs to test against. This additionally
      requires a web server hosting the Git repositories which can be cloned
      by the jobs.
    - **zuul-cloner**: client side script used to setup job workspace. It is
      used to clone the repositories prepared by the zuul-merger described
      previously.
    - **gearmand**: optional builtin gearman daemon provided by zuul-server

External components:

    - Jenkins Gearman plugin: Used by Jenkins to connect to Gearman

Zuul Communication
------------------

All the Zuul components communicate with each other using Gearman. As well as
the following communication channels:

zuul-server:

    - Gerrit
    - Gearman Daemon

zuul-merger:

    - Gerrit
    - Gearman Daemon

zuul-cloner:

    - http hosted zuul-merger git repos

Jenkins:

    - Gearman Daemon via Jenkins Gearman Plugin

Zuul Setup
----------

At minimum we need to provide **zuul.conf** and **layout.yaml** and placed
in /etc/zuul/ directory. You will also need a zuul user and ssh key for the
zuul user in Gerrit. The following example uses the builtin gearmand service
in zuul.

**zuul.conf**::

    [zuul]
    layout_config=/etc/zuul/layout.yaml

    [merger]
    git_dir=/git
    zuul_url=http://zuul.example.com/p

    [gearman_server]
    start=true

    [gearman]
    server=127.0.0.1

    [connection gerrit]
    driver=gerrit
    server=git.example.com
    port=29418
    baseurl=https://git.example.com/gerrit/
    user=zuul
    sshkey=/home/zuul/.ssh/id_rsa

See :doc:`zuul` for more details.

The following sets up a basic timer triggered job using zuul.

**layout.yaml**::

    pipelines:
      - name: periodic
        source: gerrit
        manager: IndependentPipelineManager
        trigger:
          timer:
            - time: '0 * * * *'

    projects:
      - name: aproject
        periodic:
          - aproject-periodic-build

Starting Zuul
-------------

You can run zuul-server with the **-d** option to make it not daemonize. It's
a good idea at first to confirm there's no issues with your configuration.

Simply run::

    zuul-server

Once run you should have 2 zuul-server processes::

    zuul     12102     1  0 Jan21 ?        00:15:45 /home/zuul/zuulvenv/bin/python /home/zuul/zuulvenv/bin/zuul-server -d
    zuul     12107 12102  0 Jan21 ?        00:00:01 /home/zuul/zuulvenv/bin/python /home/zuul/zuulvenv/bin/zuul-server -d

Note: In this example zuul was installed in a virtualenv.

The 2nd zuul-server process is gearmand running if you are using the builtin
gearmand server, otherwise there will only be 1 process.

Zuul won't actually process your Job queue however unless you also have a
zuul-merger process running.

Simply run::

    zuul-merger

Zuul should now be able to process your periodic job as configured above once
the Jenkins side of things is configured.

Jenkins Setup
-------------

Install the Jenkins Gearman Plugin via Jenkins Plugin management interface.
Then naviage to **Manage > Configuration > Gearman** and setup the Jenkins
server hostname/ip and port to connect to gearman.

At this point gearman should be running your Jenkins jobs.

Troubleshooting
---------------

Checking Gearman function registration (jobs). You can use telnet to connect
to gearman to check that Jenkins is registering your configured jobs in
gearman::

    telnet <gearman_ip> 4730

Useful commands are **workers** and **status** which you can run by just
typing those commands once connected to gearman. Every job in your Jenkins
master must appear when you run **workers** for Zuul to be able to run jobs
against your Jenkins instance.