blob: 6197396e3321d211db8de8e1576ff7d5d31fb327 [file] [log] [blame]
James E. Blaireff5a9d2017-06-20 00:00:37 -07001:title: Zuul Concepts
2
3Zuul Concepts
4=============
5
6Zuul's configuration is organized around the concept of a *pipeline*.
7In Zuul, a pipeline encompasses a workflow process which can be
8applied to one or more projects. For instance, a "check" pipeline
9might describe the actions which should cause newly proposed changes
10to projects to be tested. A "gate" pipeline might implement
11:ref:`project_gating` to automate merging changes to projects only if
12their tests pass. A "post" pipeline might update published
13documentation for a project when changes land.
14
15The names "check", "gate", and "post" are arbitrary -- these are not
16concepts built into Zuul, but rather they are just a few common
17examples of workflow processes that can be described to Zuul and
18implemented as pipelines.
19
20Once a pipeline has been defined, any number of projects may be
21associated with it, each one specifying what jobs should be run for
22that project in a given pipeline.
23
24Pipelines have associated *triggers* which are descriptions of events
25which should cause something to be enqueued into a pipeline. For
26example, when a patchset is uploaded to Gerrit, a Gerrit
27*patchset-created* event is emitted. A pipeline configured to trigger
28on *patchset-created* events would then enqueue the associated change
29when Zuul receives that event. If there are jobs associated with that
30project and pipeline, they will be run. In addition to Gerrit, other
31triggers are available, including GitHub, timer, and zuul. See
32:ref:`drivers` for a full list of available triggers.
33
34Once all of the jobs for an item in a pipeline have been run, the
35pipeline's *reporters* are responsible for reporting the results of
36all of the jobs. Continuing the example from earlier, if a pipeline
37were configured with a Gerrit reporter, it would leave a review
38comment on the change and set any approval votes that are configured.
39There are several reporting phases available; each of which may be
40configured with any number of reporters. See :ref:`drivers` for a
41full list of available reporters.
42
43The items enqueued into a pipeline are each associated with a git ref.
44That ref may point to a proposed change, or it may be the tip of a
45branch or a tag. The triggering event determines the ref, and whether
46it represents a proposed or merged commit. Zuul prepares the ref for
47an item before running jobs. In the case of a proposed change, that
48means speculatively merging the change into its target branch. This
49means that any jobs that operate on the change will run with the git
50repo in the state it will be in after the change merges (which may be
51substantially different than the git repo state of the change itself
52since the repo may have merged other changes since the change was
53originally authored). Items in a pipeline may depend on other items,
54and if they do, all of their dependent changes will be included in the
55git repo state that Zuul prepares. For more detail on this process,
56see :ref:`project_gating` and :ref:`dependencies`.
57
58The configuration for nearly everything described above is held in
59files inside of the git repos upon which Zuul operates. Zuul's
60configuration is global, but distributed. Jobs which are defined in
61one project might be used in another project while pipelines are
62available to all projects. When Zuul starts, it reads its
63configuration from all of the projects it knows about, and when
64changes to its configuration are proposed, those changes may take
65effect temporarily as part of the proposed change, or immediately
66after the change merges, depending on the type of project in which the
67change appears.
68
69Jobs specify the type and quantity of nodes which they require.
70Before executing each job, Zuul will contact it's companion program,
71Nodepool, to supply them. Nodepool may be configured to supply static
72nodes or contact cloud providers to create or delete nodes as
73necessary. The types of nodes available to Zuul are determined by the
74Nodepool administrator.
75
76The executable contents of jobs themselves are Ansible playbooks.
77Ansible's support for orchestrating tasks on remote nodes is
78particularly suited to Zuul's support for multi-node testing. Ansible
79is also easy to use for simple tasks (such as executing a shell
80script) or sophisticated deployment scenarios. When Zuul runs
81Ansible, it attempts to do so in a manner most similar to the way that
82Ansible might be used to orchestrate remote systems. Ansible itself
83is run on the executor and acts remotely upon the test nodes supplied
84to a job. This facilitates continuous delivery by making it possible
85to use the same Ansible playbooks in testing and production.