blob: 8ee6b6fbbd97a1af141c45386b3454b4b04e1cb0 [file] [log] [blame]
James E. Blair4ce47da2013-12-05 14:06:08 -08001:title: Zuul Client
2
3Zuul Client
4===========
5
6Zuul includes a simple command line client that may be used by
7administrators to affect Zuul's behavior while running. It must be
8run on a host that has access to the Gearman server (e.g., locally on
9the Zuul host).
10
11Configuration
12-------------
13
14The client uses the same zuul.conf file as the server, and will look
15for it in the same locations if not specified on the command line.
16
17Usage
18-----
19The general options that apply to all subcommands are:
20
21.. program-output:: zuul --help
22
23The following subcommands are supported:
24
David Shrewsburyffab07a2017-07-24 12:45:07 -040025Autohold
26^^^^^^^^
27.. program-output:: zuul autohold --help
28
29Example::
30
David Shrewsbury36b2adf2017-07-31 15:40:13 -040031 zuul autohold --tenant openstack --project example_project --job example_job --reason "reason text" --count 1
David Shrewsburyffab07a2017-07-24 12:45:07 -040032
James E. Blair4ce47da2013-12-05 14:06:08 -080033Enqueue
34^^^^^^^
35.. program-output:: zuul enqueue --help
36
37Example::
38
Paul Belangerbaca3132016-11-04 12:49:54 -040039 zuul enqueue --tenant openstack --trigger gerrit --pipeline check --project example_project --change 12345,1
Akihiro Motoki7109dc62014-02-10 19:09:28 +090040
41Note that the format of change id is <number>,<patchset>.
Antoine Musso6aa89842014-06-30 21:35:26 +020042
Ian Wienand25f3a312017-11-09 14:29:12 +110043Enqueue-ref
44^^^^^^^^^^^
45
46.. program-output:: zuul enqueue-ref --help
47
48This command is provided to manually simulate a trigger from an
49external source. It can be useful for testing or replaying a trigger
50that is difficult or impossible to recreate at the source. The
51arguments to ``enqueue-ref`` will vary depending on the source and
52type of trigger. Some familiarity with the arguments emitted by
53``gerrit`` `update hooks
54<https://gerrit-review.googlesource.com/admin/projects/plugins/hooks>`__
55such as ``patchset-created`` and ``ref-updated`` is recommended. Some
56examples of common operations are provided below.
57
58Manual enqueue examples
59***********************
60
61It is common to have a ``release`` pipeline that listens for new tags
62coming from ``gerrit`` and performs a range of code packaging jobs.
63If there is an unexpected issue in the release jobs, the same tag can
64not be recreated in ``gerrit`` and the user must either tag a new
65release or request a manual re-triggering of the jobs. To re-trigger
66the jobs, pass the failed tag as the ``ref`` argument and set
67``newrev`` to the change associated with the tag in the project
68repository (i.e. what you see from ``git show X.Y.Z``)::
69
70 zuul enqueue-ref --tenant openstack --trigger gerrit --pipeline release --project openstack/example_project --ref refs/tags/X.Y.Z --newrev abc123...
71
72The command can also be used asynchronosly trigger a job in a
73``periodic`` pipeline that would usually be run at a specific time by
74the ``timer`` driver. For example, the following command would
75trigger the ``periodic`` jobs against the current ``master`` branch
76top-of-tree for a project::
77
78 zuul enqueue-ref --tenant openstack --trigger timer --pipeline periodic --project openstack/example_project --ref refs/heads/master
79
80Another common pipeline is a ``post`` queue listening for ``gerrit``
81merge results. Triggering here is slightly more complicated as you
82wish to recreate the full ``ref-updated`` event from ``gerrit``. For
83a new commit on ``master``, the gerrit ``ref-updated`` trigger
84expresses "reset ``refs/heads/master`` for the project from ``oldrev``
85to ``newrev``" (``newrev`` being the committed change). Thus to
86replay the event, you could ``git log`` in the project and take the
87current ``HEAD`` and the prior change, then enqueue the event::
88
89 NEW_REF=$(git rev-parse HEAD)
90 OLD_REF=$(git rev-parse HEAD~1)
91
92 zuul enqueue-ref --tenant openstack --trigger gerrit --pipeline post --project openstack/example_project --ref refs/heads/master --newrev $NEW_REF --oldrev $OLD_REF
93
94Note that zero values for ``oldrev`` and ``newrev`` can indicate
95branch creation and deletion; the source code is the best reference
96for these more advanced operations.
97
98
Antoine Musso6aa89842014-06-30 21:35:26 +020099Promote
100^^^^^^^
101.. program-output:: zuul promote --help
102
103Example::
104
Paul Belangerbaca3132016-11-04 12:49:54 -0400105 zuul promote --tenant openstack --pipeline check --changes 12345,1 13336,3
Antoine Musso6aa89842014-06-30 21:35:26 +0200106
107Note that the format of changes id is <number>,<patchset>.
108
109Show
110^^^^
111.. program-output:: zuul show --help
112
113Example::
114
115 zuul show running-jobs