James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 1 | :title: Launchers |
| 2 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 3 | .. _Gearman: http://gearman.org/ |
Antoine Musso | d06f2a6 | 2012-11-16 17:40:58 +0100 | [diff] [blame] | 4 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 5 | .. _`Gearman Plugin`: |
| 6 | https://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin |
| 7 | |
Joshua Hesketh | 6a0a618 | 2014-03-13 13:23:30 +1100 | [diff] [blame] | 8 | .. _`Turbo-Hipster`: |
| 9 | http://git.openstack.org/cgit/stackforge/turbo-hipster/ |
| 10 | |
| 11 | .. _`Turbo-Hipster Documentation`: |
| 12 | http://turbo-hipster.rtfd.org/ |
| 13 | |
Joshua Hesketh | 36c3fa5 | 2014-01-22 11:40:52 +1100 | [diff] [blame] | 14 | .. _FormPost: http://docs.openstack.org/developer/swift/misc.html#module-swift.common.middleware.formpost |
| 15 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 16 | .. _launchers: |
Antoine Musso | d06f2a6 | 2012-11-16 17:40:58 +0100 | [diff] [blame] | 17 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 18 | Launchers |
| 19 | ========= |
| 20 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 21 | Zuul has a modular architecture for launching jobs. Currently, the |
| 22 | only supported module interfaces with Gearman_. This design allows |
| 23 | any system to run jobs for Zuul simply by interfacing with a Gearman |
| 24 | server. The recommended way of integrating a new job-runner with Zuul |
| 25 | is via this method. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 26 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 27 | If Gearman is unsuitable, Zuul may be extended with a new launcher |
| 28 | module. Zuul makes very few assumptions about the interface to a |
| 29 | launcher -- if it can trigger jobs, cancel them, and receive success |
| 30 | or failure reports, it should be able to be used with Zuul. Patches |
| 31 | to this effect are welcome. |
| 32 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 33 | Zuul Parameters |
| 34 | --------------- |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 35 | |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 36 | Zuul will pass some parameters with every job it launches. These are |
| 37 | for workers to be able to get the repositories into the state they are |
| 38 | intended to be tested in. Builds can be triggered either by an action |
| 39 | on a change or by a reference update. Both events share a common set |
| 40 | of parameters and more specific parameters as follows: |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 41 | |
| 42 | Common parameters |
| 43 | ~~~~~~~~~~~~~~~~~ |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 44 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 45 | **ZUUL_UUID** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 46 | Zuul provided key to link builds with Gerrit events. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 47 | **ZUUL_REF** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 48 | Zuul provided ref that includes commit(s) to build. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 49 | **ZUUL_COMMIT** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 50 | The commit SHA1 at the head of ZUUL_REF. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 51 | **ZUUL_PROJECT** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 52 | The project that triggered this build. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 53 | **ZUUL_PIPELINE** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 54 | The Zuul pipeline that is building this job. |
Arx Cruz | b1b010d | 2013-10-28 19:49:59 -0200 | [diff] [blame] | 55 | **ZUUL_URL** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 56 | The URL for the zuul server as configured in zuul.conf. |
Joshua Hesketh | ba8776a | 2014-01-12 14:35:40 +0800 | [diff] [blame] | 57 | A test runner may use this URL as the basis for fetching |
Arx Cruz | b1b010d | 2013-10-28 19:49:59 -0200 | [diff] [blame] | 58 | git commits. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 59 | |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 60 | Change related parameters |
| 61 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 62 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 63 | The following additional parameters will only be provided for builds |
| 64 | associated with changes (i.e., in response to patchset-created or |
| 65 | comment-added events): |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 66 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 67 | **ZUUL_BRANCH** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 68 | The target branch for the change that triggered this build. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 69 | **ZUUL_CHANGE** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 70 | The Gerrit change ID for the change that triggered this build. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 71 | **ZUUL_CHANGE_IDS** |
| 72 | All of the Gerrit change IDs that are included in this build (useful |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 73 | when the DependentPipelineManager combines changes for testing). |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 74 | **ZUUL_PATCHSET** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 75 | The Gerrit patchset number for the change that triggered this build. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 76 | |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 77 | Reference updated parameters |
| 78 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 79 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 80 | The following additional parameters will only be provided for |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 81 | post-merge (ref-updated) builds: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 82 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 83 | **ZUUL_OLDREV** |
| 84 | The SHA1 of the old revision at this ref (recall the ref name is |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 85 | in ZUUL_REF). |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 86 | **ZUUL_NEWREV** |
| 87 | The SHA1 of the new revision at this ref (recall the ref name is |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 88 | in ZUUL_REF). |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 89 | **ZUUL_SHORT_OLDREV** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 90 | The shortened (7 character) SHA1 of the old revision. |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 91 | **ZUUL_SHORT_NEWREV** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 92 | The shortened (7 character) SHA1 of the new revision. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 93 | |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 94 | Unset revisions default to 00000000000000000000000000000000. |
| 95 | |
| 96 | Examples: |
| 97 | |
| 98 | When a reference is created:: |
| 99 | |
| 100 | ZUUL_OLDREV=00000000000000000000000000000000 |
| 101 | ZUUL_NEWREV=123456789abcdef123456789abcdef12 |
| 102 | ZUUL_SHORT_OLDREV=0000000 |
| 103 | ZUUL_SHORT_NEWREV=1234567 |
| 104 | |
| 105 | When a reference is deleted:: |
| 106 | |
| 107 | ZUUL_OLDREV=123456789abcdef123456789abcdef12 |
| 108 | ZUUL_NEWREV=00000000000000000000000000000000 |
| 109 | ZUUL_SHORT_OLDREV=1234567 |
| 110 | ZUUL_SHORT_NEWREV=0000000 |
| 111 | |
| 112 | And finally a reference being altered:: |
| 113 | |
| 114 | ZUUL_OLDREV=123456789abcdef123456789abcdef12 |
| 115 | ZUUL_NEWREV=abcdef123456789abcdef123456789ab |
| 116 | ZUUL_SHORT_OLDREV=1234567 |
| 117 | ZUUL_SHORT_NEWREV=abcdef1 |
| 118 | |
| 119 | Your jobs can check whether the parameters are ``000000`` to act |
| 120 | differently on each kind of event. |
| 121 | |
Joshua Hesketh | 36c3fa5 | 2014-01-22 11:40:52 +1100 | [diff] [blame] | 122 | Swift parameters |
| 123 | ~~~~~~~~~~~~~~~~ |
| 124 | |
| 125 | If swift information has been configured for the job zuul will also |
| 126 | provide signed credentials for the builder to upload results and |
| 127 | assets into containers using the `FormPost`_ middleware. |
| 128 | |
| 129 | Each zuul container/instruction set will contain each of the following |
| 130 | parameters where $NAME is the ``name`` defined in the layout. |
| 131 | |
| 132 | *SWIFT_$NAME_URL* |
| 133 | The swift destination URL. This will be the entire URL including |
| 134 | the AUTH, container and path prefix (folder). |
| 135 | *SWIFT_$NAME_HMAC_BODY* |
| 136 | The information signed in the HMAC body. The body is as follows:: |
| 137 | |
| 138 | PATH TO OBJECT PREFIX (excluding domain) |
| 139 | BLANK LINE (zuul implements no form redirect) |
| 140 | MAX FILE SIZE |
| 141 | MAX FILE COUNT |
| 142 | SIGNATURE EXPIRY |
| 143 | |
| 144 | *SWIFT_$NAME_SIGNATURE* |
| 145 | The HMAC body signed with the configured key. |
| 146 | *SWIFT_$NAME_LOGSERVER_PREFIX* |
| 147 | The URL to prepend to the object path when returning the results |
| 148 | from a build. |
| 149 | |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 150 | Gearman |
| 151 | ------- |
| 152 | |
| 153 | Gearman_ is a general-purpose protocol for distributing jobs to any |
| 154 | number of workers. Zuul works with Gearman by sending specific |
| 155 | information with job requests to Gearman, and expects certain |
| 156 | information to be returned on completion. This protocol is described |
| 157 | in `Zuul-Gearman Protocol`_. |
| 158 | |
| 159 | In order for Zuul to run any jobs, you will need a running Gearman |
| 160 | server. Zuul includes a Gearman server, and it is recommended that it |
| 161 | be used as it supports the following features needed by Zuul: |
| 162 | |
| 163 | * Canceling jobs in the queue (admin protocol command "cancel job"). |
| 164 | * Strict FIFO queue operation (gearmand's round-robin mode may be |
| 165 | sufficient, but is untested). |
| 166 | |
| 167 | To enable the built-in server, see the ``gearman_server`` section of |
| 168 | ``zuul.conf``. Be sure that the host allows connections from Zuul and |
| 169 | any workers (e.g., Jenkins masters) on TCP port 4730, and nowhere else |
| 170 | (as the Gearman protocol does not include any provision for |
| 171 | authentication). |
| 172 | |
| 173 | Gearman Jenkins Plugin |
| 174 | ~~~~~~~~~~~~~~~~~~~~~~ |
| 175 | |
| 176 | The `Gearman Jenkins Plugin`_ makes it easy to use Jenkins with Zuul |
| 177 | by providing an interface between Jenkins and Gearman. In this |
| 178 | configuration, Zuul asks Gearman to run jobs, and Gearman can then |
| 179 | distribute those jobs to any number of Jenkins systems (including |
| 180 | multiple Jenkins masters). |
| 181 | |
| 182 | The `Gearman Plugin`_ can be installed in Jenkins in order to |
| 183 | facilitate Jenkins running jobs for Zuul. Install the plugin and |
| 184 | configure it with the hostname or IP address of your Gearman server |
| 185 | and the port on which it is listening (4730 by default). It will |
| 186 | automatically register all known Jenkins jobs as functions that Zuul |
| 187 | can invoke via Gearman. |
| 188 | |
| 189 | Any number of masters can be configured in this way, and Gearman will |
| 190 | distribute jobs to all of them as appropriate. |
| 191 | |
| 192 | No special Jenkins job configuration is needed to support triggering |
| 193 | by Zuul. |
| 194 | |
| 195 | The Gearman Plugin will ensure the `Zuul Parameters`_ are supplied as |
| 196 | Jenkins build parameters, so they will be available for use in the job |
| 197 | configuration as well as to the running job as environment variables. |
| 198 | |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 199 | Jenkins git plugin configuration |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 200 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Antoine Musso | e0f5bb4 | 2014-03-04 11:30:37 +0100 | [diff] [blame] | 201 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 202 | In order to test the correct build, configure the Jenkins Git SCM |
| 203 | plugin as follows:: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 204 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 205 | Source Code Management: |
| 206 | Git |
| 207 | Repositories: |
| 208 | Repository URL: <your Gerrit or Zuul repository URL> |
| 209 | Advanced: |
| 210 | Refspec: ${ZUUL_REF} |
| 211 | Branches to build: |
| 212 | Branch Specifier: ${ZUUL_COMMIT} |
James E. Blair | e281901 | 2013-06-28 17:17:26 -0400 | [diff] [blame] | 213 | Advanced: |
| 214 | Clean after checkout: True |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 215 | |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 216 | That should be sufficient for a job that only builds a single project. |
| 217 | If you have multiple interrelated projects (i.e., they share a Zuul |
| 218 | Change Queue) that are built together, you may be able to configure |
| 219 | the Git plugin to prepare them, or you may chose to use a shell script |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 220 | instead. As an example, the OpenStack project uses the following |
| 221 | script to prepare the workspace for its integration testing: |
James E. Blair | 81515ad | 2012-10-01 18:29:08 -0700 | [diff] [blame] | 222 | |
K Jonathan Harker | 97e457e | 2013-02-26 13:29:38 -0800 | [diff] [blame] | 223 | https://github.com/openstack-infra/devstack-gate/blob/master/devstack-vm-gate-wrap.sh |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 224 | |
Joshua Hesketh | 6a0a618 | 2014-03-13 13:23:30 +1100 | [diff] [blame] | 225 | Turbo Hipster Worker |
| 226 | ~~~~~~~~~~~~~~~~~~~~ |
| 227 | |
| 228 | As an alternative to Jenkins, `Turbo-Hipster`_ is a small python |
| 229 | project designed specifically as a zuul job worker which can be |
| 230 | registered with gearman as a job runner. Please see the |
| 231 | `Turbo-Hipster Documentation`_ for details on how to set it up. |
| 232 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 233 | Zuul-Gearman Protocol |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 234 | ~~~~~~~~~~~~~~~~~~~~~ |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 235 | |
| 236 | This section is only relevant if you intend to implement a new kind of |
| 237 | worker that runs jobs for Zuul via Gearman. If you just want to use |
| 238 | Jenkins, see `Gearman Jenkins Plugin`_ instead. |
| 239 | |
| 240 | The Zuul protocol as used with Gearman is as follows: |
| 241 | |
| 242 | Starting Builds |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 243 | ^^^^^^^^^^^^^^^ |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 244 | |
| 245 | To start a build, Zuul invokes a Gearman function with the following |
| 246 | format: |
| 247 | |
| 248 | build:FUNCTION_NAME |
| 249 | |
| 250 | where **FUNCTION_NAME** is the name of the job that should be run. If |
| 251 | the job should run on a specific node (or class of node), Zuul will |
| 252 | instead invoke: |
| 253 | |
| 254 | build:FUNCTION_NAME:NODE_NAME |
| 255 | |
| 256 | where **NODE_NAME** is the name or class of node on which the job |
| 257 | should be run. This can be specified by setting the ZUUL_NODE |
Antoine Musso | 7c5db97 | 2013-09-26 11:48:26 +0200 | [diff] [blame] | 258 | parameter in a parameter-function (see :ref:`includes` section in |
| 259 | :ref:`zuulconf`). |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 260 | |
| 261 | Zuul sends the ZUUL_* parameters described in `Zuul Parameters`_ |
| 262 | encoded in JSON format as the argument included with the |
| 263 | SUBMIT_JOB_UNIQ request to Gearman. A unique ID (equal to the |
| 264 | ZUUL_UUID parameter) is also supplied to Gearman, and is accessible as |
| 265 | an added Gearman parameter with GRAB_JOB_UNIQ. |
| 266 | |
| 267 | When a Gearman worker starts running a job for Zuul, it should |
| 268 | immediately send a WORK_DATA packet with the following information |
| 269 | encoded in JSON format: |
| 270 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 271 | **name** |
| 272 | The name of the job. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 273 | |
| 274 | **number** |
| 275 | The build number (unique to this job). |
| 276 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 277 | **manager** |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 278 | A unique identifier associated with the Gearman worker that can |
| 279 | abort this build. See `Stopping Builds`_ for more information. |
| 280 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 281 | **url** (optional) |
| 282 | The URL with the status or results of the build. Will be used in |
| 283 | the status page and the final report. |
| 284 | |
Joshua Hesketh | ba8776a | 2014-01-12 14:35:40 +0800 | [diff] [blame] | 285 | To help with debugging builds a worker may send back some optional |
| 286 | metadata: |
| 287 | |
| 288 | **worker_name** (optional) |
| 289 | The name of the worker. |
| 290 | |
| 291 | **worker_hostname** (optional) |
| 292 | The hostname of the worker. |
| 293 | |
| 294 | **worker_ips** (optional) |
| 295 | A list of IPs for the worker. |
| 296 | |
| 297 | **worker_fqdn** (optional) |
| 298 | The FQDN of the worker. |
| 299 | |
| 300 | **worker_program** (optional) |
| 301 | The program name of the worker. For example Jenkins or turbo-hipster. |
| 302 | |
| 303 | **worker_version** (optional) |
| 304 | The version of the software running the job. |
| 305 | |
| 306 | **worker_extra** (optional) |
| 307 | A dictionary of any extra metadata you may want to pass along. |
| 308 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 309 | It should then immediately send a WORK_STATUS packet with a value of 0 |
| 310 | percent complete. It may then optionally send subsequent WORK_STATUS |
| 311 | packets with updated completion values. |
| 312 | |
| 313 | When the build is complete, it should send a final WORK_DATA packet |
| 314 | with the following in JSON format: |
| 315 | |
| 316 | **result** |
| 317 | Either the string 'SUCCESS' if the job succeeded, or any other value |
| 318 | that describes the result if the job failed. |
| 319 | |
| 320 | Finally, it should send either a WORK_FAIL or WORK_COMPLETE packet as |
| 321 | appropriate. A WORK_EXCEPTION packet will be interpreted as a |
| 322 | WORK_FAIL, but the exception will be logged in Zuul's error log. |
| 323 | |
| 324 | Stopping Builds |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 325 | ^^^^^^^^^^^^^^^ |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 326 | |
| 327 | If Zuul needs to abort a build already in progress, it will invoke the |
| 328 | following function through Gearman: |
| 329 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 330 | stop:MANAGER_NAME |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 331 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 332 | Where **MANAGER_NAME** is the name of the manager worker supplied in |
| 333 | the initial WORK_DATA packet when the job started. This is used to |
| 334 | direct the stop: function invocation to the correct Gearman worker |
| 335 | that is capable of stopping that particular job. The argument to the |
| 336 | function should be the following encoded in JSON format: |
| 337 | |
| 338 | **name** |
| 339 | The job name of the build to stop. |
| 340 | |
| 341 | **number** |
| 342 | The build number of the build to stop. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 343 | |
| 344 | The original job is expected to complete with a WORK_DATA and |
| 345 | WORK_FAIL packet as described in `Starting Builds`_. |
| 346 | |
| 347 | Build Descriptions |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 348 | ^^^^^^^^^^^^^^^^^^ |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 349 | |
| 350 | In order to update the job running system with a description of the |
| 351 | current state of all related builds, the job runner may optionally |
| 352 | implement the following Gearman function: |
| 353 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 354 | set_description:MANAGER_NAME |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 355 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 356 | Where **MANAGER_NAME** is used as described in `Stopping Builds`_. |
| 357 | The argument to the function is the following encoded in JSON format: |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 358 | |
James E. Blair | 3c483cf | 2013-06-04 16:30:43 -0700 | [diff] [blame] | 359 | **name** |
| 360 | The job name of the build to describe. |
| 361 | |
| 362 | **number** |
| 363 | The build number of the build to describe. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 364 | |
| 365 | **html_description** |
| 366 | The description of the build in HTML format. |