blob: 318de09c4f9bc9efdcd6eace78c23e05db0ea08e [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
David Shrewsburyb040b0a2017-08-03 15:53:59 -040043The items enqueued into a pipeline are each associated with a
44`git ref <https://git-scm.com/book/en/v2/Git-Internals-Git-References>`_.
James E. Blaireff5a9d2017-06-20 00:00:37 -070045That ref may point to a proposed change, or it may be the tip of a
46branch or a tag. The triggering event determines the ref, and whether
47it represents a proposed or merged commit. Zuul prepares the ref for
48an item before running jobs. In the case of a proposed change, that
49means speculatively merging the change into its target branch. This
50means that any jobs that operate on the change will run with the git
51repo in the state it will be in after the change merges (which may be
52substantially different than the git repo state of the change itself
53since the repo may have merged other changes since the change was
54originally authored). Items in a pipeline may depend on other items,
55and if they do, all of their dependent changes will be included in the
56git repo state that Zuul prepares. For more detail on this process,
57see :ref:`project_gating` and :ref:`dependencies`.
58
59The configuration for nearly everything described above is held in
60files inside of the git repos upon which Zuul operates. Zuul's
61configuration is global, but distributed. Jobs which are defined in
62one project might be used in another project while pipelines are
63available to all projects. When Zuul starts, it reads its
64configuration from all of the projects it knows about, and when
65changes to its configuration are proposed, those changes may take
66effect temporarily as part of the proposed change, or immediately
67after the change merges, depending on the type of project in which the
68change appears.
69
70Jobs specify the type and quantity of nodes which they require.
David Shrewsburyb040b0a2017-08-03 15:53:59 -040071Before executing each job, Zuul will contact its companion program,
James E. Blaireff5a9d2017-06-20 00:00:37 -070072Nodepool, to supply them. Nodepool may be configured to supply static
73nodes or contact cloud providers to create or delete nodes as
74necessary. The types of nodes available to Zuul are determined by the
75Nodepool administrator.
76
77The executable contents of jobs themselves are Ansible playbooks.
78Ansible's support for orchestrating tasks on remote nodes is
79particularly suited to Zuul's support for multi-node testing. Ansible
80is also easy to use for simple tasks (such as executing a shell
81script) or sophisticated deployment scenarios. When Zuul runs
82Ansible, it attempts to do so in a manner most similar to the way that
83Ansible might be used to orchestrate remote systems. Ansible itself
David Shrewsburyb040b0a2017-08-03 15:53:59 -040084is run on the :ref:`executor <executor>` and acts remotely upon the test
85nodes supplied to a job. This facilitates continuous delivery by making it
86possible to use the same Ansible playbooks in testing and production.