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