blob: 9ec46467134fc4728d4e7c71ba344b67b5385bc1 [file] [log] [blame]
James E. Blaireff5a9d2017-06-20 00:00:37 -07001:title: Job Content
2
3Job Content
4===========
5
David Shrewsburyc50cb572017-08-04 11:55:01 -04006Zuul jobs are implemented as Ansible playbooks. Zuul prepares the
James E. Blaireff5a9d2017-06-20 00:00:37 -07007repositories used for a job, installs any required Ansible roles, and
8then executes the job's playbooks. Any setup or artifact collection
9required is the responsibility of the job itself. While this flexible
10arrangement allows for almost any kind of job to be run by Zuul,
11batteries are included. Zuul has a standard library of jobs upon
12which to build.
13
14Working Directory
15-----------------
16
17Before starting each job, the Zuul executor creates a directory to
18hold all of the content related to the job. This includes some
19directories which are used by Zuul to configure and run Ansible and
20may not be accessible, as well as a directory tree, under ``work/``,
21that is readable and writable by the job. The hierarchy is:
22
23**work/**
24 The working directory of the job.
25
26**work/src/**
27 Contains the prepared git repositories for the job.
28
29**work/logs/**
30 Where the Ansible log for the job is written; your job
31 may place other logs here as well.
32
33Git Repositories
34----------------
35
36The git repositories in ``work/src`` contain the repositories for all
37of the projects specified in the ``required-projects`` section of the
38job, plus the project associated with the queue item if it isn't
39already in that list. In the case of a proposed change, that change
40and all of the changes ahead of it in the pipeline queue will already
41be merged into their respective repositories and target branches. The
42change's project will have the change's branch checked out, as will
43all of the other projects, if that branch exists (otherwise, a
44fallback or default branch will be used). If your job needs to
45operate on multiple branches, simply checkout the appropriate branches
46of these git repos to ensure that the job results reflect the proposed
47future state that Zuul is testing, and all dependencies are present.
48Do not use any git remotes; the local repositories are guaranteed to
49be up to date.
50
James E. Blair4d5dd252017-06-23 21:40:56 +010051The repositories will be placed on the filesystem in directories
52corresponding with the canonical hostname of their source connection.
53For example::
54
55 work/src/git.example.com/project1
56 work/src/github.com/project2
57
58Is the layout that would be present for a job which included project1
59from the connection associated to git.example.com and project2 from
60GitHub. This helps avoid collisions between projects with the same
61name, and some language environments, such as Go, expect repositories
62in this format.
63
James E. Blaireff5a9d2017-06-20 00:00:37 -070064Note that these git repositories are located on the executor; in order
65to be useful to most kinds of jobs, they will need to be present on
Jeremy Stanley21df5962018-01-08 21:35:58 +000066the test nodes. The ``base`` job in the standard library (see
67`zuul-base-jobs documentation`_ for details) contains a
James E. Blaireff5a9d2017-06-20 00:00:37 -070068pre-playbook which copies the repositories to all of the job's nodes.
69It is recommended to always inherit from this base job to ensure that
70behavior.
71
Jeremy Stanley21df5962018-01-08 21:35:58 +000072.. _zuul-base-jobs documentation: https://docs.openstack.org/infra/zuul-base-jobs/jobs.html#job-base
73
74.. TODO: document src (and logs?) directory
James E. Blaireff5a9d2017-06-20 00:00:37 -070075
James E. Blair28c8e3b2017-07-17 16:27:50 -070076Variables
77---------
78
Jamie Lennox7655b552017-03-17 12:33:38 +110079There are several sources of variables which are available to Ansible:
80variables defined in jobs, secrets, and site-wide variables. The
81order of precedence is:
82
83* Site-wide variables
84
85* Secrets
86
87* Job variables
88
James E. Blair698703c2017-09-15 20:58:30 -060089* Parent job results
90
Jamie Lennox7655b552017-03-17 12:33:38 +110091Meaning that a site-wide variable with the same name as any other will
92override its value, and similarly, secrets override job variables of
James E. Blair698703c2017-09-15 20:58:30 -060093the same name which override data returned from parent jobs. Each of
94the sources is described below.
Jamie Lennox7655b552017-03-17 12:33:38 +110095
96
97Job Variables
98~~~~~~~~~~~~~
99
James E. Blaird9f0efb2017-08-02 16:07:44 -0700100Any variables specified in the job definition (using the
101:attr:`job.vars` attribute) are available as Ansible host variables.
102They are added to the ``vars`` section of the inventory file under the
103``all`` hosts group, so they are available to all hosts. Simply refer
104to them by the name specified in the job's ``vars`` section.
James E. Blair28c8e3b2017-07-17 16:27:50 -0700105
106Secrets
107~~~~~~~
108
James E. Blaird9f0efb2017-08-02 16:07:44 -0700109:ref:`Secrets <secret>` also appear as variables available to Ansible.
110Unlike job variables, these are not added to the inventory file (so
111that the inventory file may be kept for debugging purposes without
112revealing secrets). But they are still available to Ansible as normal
James E. Blair28c8e3b2017-07-17 16:27:50 -0700113variables. Because secrets are groups of variables, they will appear
114as a dictionary structure in templates, with the dictionary itself
115being the name of the secret, and its members the individual items in
James E. Blaird9f0efb2017-08-02 16:07:44 -0700116the secret. For example, a secret defined as:
117
118.. code-block:: yaml
James E. Blair28c8e3b2017-07-17 16:27:50 -0700119
120 - secret:
121 name: credentials
122 data:
123 username: foo
124 password: bar
125
126Might be used in a template as::
127
128 {{ credentials.username }} {{ credentials.password }}
129
James E. Blair892cca62017-08-09 11:36:58 -0700130Secrets are only available to playbooks associated with the job
131definition which uses the secret; they are not available to playbooks
132associated with child jobs or job variants.
James E. Blair28c8e3b2017-07-17 16:27:50 -0700133
James E. Blaireff5a9d2017-06-20 00:00:37 -0700134Zuul Variables
James E. Blair28c8e3b2017-07-17 16:27:50 -0700135~~~~~~~~~~~~~~
James E. Blaireff5a9d2017-06-20 00:00:37 -0700136
137Zuul supplies not only the variables specified by the job definition
James E. Blaird9f0efb2017-08-02 16:07:44 -0700138to Ansible, but also some variables from Zuul itself.
James E. Blair21037782017-07-19 11:56:55 -0700139
James E. Blairbabefce2017-07-20 17:14:54 -0700140When a pipeline is triggered by an action, it enqueues items which may
James E. Blair21037782017-07-19 11:56:55 -0700141vary based on the pipeline's configuration. For example, when a new
142change is created, that change may be enqueued into the pipeline,
143while a tag may be enqueued into the pipeline when it is pushed.
144
145Information about these items is available to jobs. All of the items
146enqueued in a pipeline are git references, and therefore share some
147attributes in common. But other attributes may vary based on the type
148of item.
149
James E. Blaird9f0efb2017-08-02 16:07:44 -0700150.. var:: zuul
James E. Blair21037782017-07-19 11:56:55 -0700151
James E. Blaird9f0efb2017-08-02 16:07:44 -0700152 All items provide the following information as Ansible variables
153 under the ``zuul`` key:
James E. Blair21037782017-07-19 11:56:55 -0700154
James E. Blaird9f0efb2017-08-02 16:07:44 -0700155 .. var:: build
James E. Blair21037782017-07-19 11:56:55 -0700156
James E. Blaird9f0efb2017-08-02 16:07:44 -0700157 The UUID of the build. A build is a single execution of a job.
158 When an item is enqueued into a pipeline, this usually results
159 in one build of each job configured for that item's project.
160 However, items may be re-enqueued in which case another build
161 may run. In dependent pipelines, the same job may run multiple
162 times for the same item as circumstances change ahead in the
163 queue. Each time a job is run, for whatever reason, it is
164 acompanied with a new unique id.
James E. Blair21037782017-07-19 11:56:55 -0700165
James E. Blaird9f0efb2017-08-02 16:07:44 -0700166 .. var:: buildset
James E. Blair21037782017-07-19 11:56:55 -0700167
James E. Blaird9f0efb2017-08-02 16:07:44 -0700168 The build set UUID. When Zuul runs jobs for an item, the
169 collection of those jobs is known as a buildset. If the
170 configuration of items ahead in a dependent pipeline changes,
171 Zuul creates a new buildset and restarts all of the jobs.
James E. Blair21037782017-07-19 11:56:55 -0700172
James E. Blaird9f0efb2017-08-02 16:07:44 -0700173 .. var:: ref
James E. Blair2ef29e92017-07-21 15:25:05 -0700174
James E. Blaird9f0efb2017-08-02 16:07:44 -0700175 The git ref of the item. This will be the full path (e.g.,
176 `refs/heads/master` or `refs/changes/...`).
James E. Blair21037782017-07-19 11:56:55 -0700177
James E. Blairbae8fec2017-11-21 10:19:06 -0800178 .. var:: override_checkout
179
180 If the job was configured to override the branch or tag checked
James E. Blair4ad12ea2017-11-30 14:41:06 -0800181 out, this will contain the specified value. Otherwise, this
182 variable will be undefined.
James E. Blairbae8fec2017-11-21 10:19:06 -0800183
James E. Blaird9f0efb2017-08-02 16:07:44 -0700184 .. var:: pipeline
James E. Blair21037782017-07-19 11:56:55 -0700185
James E. Blaird9f0efb2017-08-02 16:07:44 -0700186 The name of the pipeline in which the job is being run.
Monty Taylor299f94b2017-07-28 17:16:36 -0500187
James E. Blaird9f0efb2017-08-02 16:07:44 -0700188 .. var:: job
James E. Blair21037782017-07-19 11:56:55 -0700189
James E. Blaird9f0efb2017-08-02 16:07:44 -0700190 The name of the job being run.
James E. Blair21037782017-07-19 11:56:55 -0700191
James E. Blaird9f0efb2017-08-02 16:07:44 -0700192 .. var:: voting
James E. Blair21037782017-07-19 11:56:55 -0700193
James E. Blaird9f0efb2017-08-02 16:07:44 -0700194 A boolean indicating whether the job is voting.
James E. Blair21037782017-07-19 11:56:55 -0700195
James E. Blaird9f0efb2017-08-02 16:07:44 -0700196 .. var:: project
James E. Blair21037782017-07-19 11:56:55 -0700197
James E. Blaird9f0efb2017-08-02 16:07:44 -0700198 The item's project. This is a data structure with the following
199 fields:
James E. Blair21037782017-07-19 11:56:55 -0700200
James E. Blaird9f0efb2017-08-02 16:07:44 -0700201 .. var:: name
Monty Taylor299f94b2017-07-28 17:16:36 -0500202
James E. Blaird9f0efb2017-08-02 16:07:44 -0700203 The name of the project, excluding hostname. E.g., `org/project`.
Monty Taylor299f94b2017-07-28 17:16:36 -0500204
James E. Blaird9f0efb2017-08-02 16:07:44 -0700205 .. var:: short_name
Monty Taylor299f94b2017-07-28 17:16:36 -0500206
James E. Blaird9f0efb2017-08-02 16:07:44 -0700207 The name of the project, excluding directories or
208 organizations. E.g., `project`.
Monty Taylor299f94b2017-07-28 17:16:36 -0500209
James E. Blaird9f0efb2017-08-02 16:07:44 -0700210 .. var:: canonical_hostname
Monty Taylor299f94b2017-07-28 17:16:36 -0500211
James E. Blaird9f0efb2017-08-02 16:07:44 -0700212 The canonical hostname where the project lives. E.g.,
213 `git.example.com`.
Monty Taylor299f94b2017-07-28 17:16:36 -0500214
James E. Blaird9f0efb2017-08-02 16:07:44 -0700215 .. var:: canonical_name
216
217 The full canonical name of the project including hostname.
218 E.g., `git.example.com/org/project`.
219
Monty Taylor9e67bb72017-08-08 15:32:06 -0500220 .. var:: src_dir
221
James E. Blairba46c062017-08-28 16:23:24 -0700222 The path to the source code relative to the work dir. E.g.,
223 `src/git.example.com/org/project`.
Monty Taylor9e67bb72017-08-08 15:32:06 -0500224
James E. Blairba46c062017-08-28 16:23:24 -0700225 .. var:: projects
Ian Wienand42234422017-10-23 16:03:53 +1100226 :type: dict
James E. Blairba46c062017-08-28 16:23:24 -0700227
Clark Boylan3934e3f2017-12-06 11:03:26 -0800228 A dictionary of all projects prepared by Zuul for the item. It
James E. Blairba46c062017-08-28 16:23:24 -0700229 includes, at least, the item's own project. It also includes
230 the projects of any items this item depends on, as well as the
231 projects that appear in :attr:`job.required-projects`.
232
Ian Wienand42234422017-10-23 16:03:53 +1100233 This is a dictionary of dictionaries. Each value has a key of
234 the `canonical_name`, then each entry consists of:
James E. Blairba46c062017-08-28 16:23:24 -0700235
236 .. var:: name
237
238 The name of the project, excluding hostname. E.g., `org/project`.
239
240 .. var:: short_name
241
242 The name of the project, excluding directories or
243 organizations. E.g., `project`.
244
245 .. var:: canonical_hostname
246
247 The canonical hostname where the project lives. E.g.,
248 `git.example.com`.
249
250 .. var:: canonical_name
251
252 The full canonical name of the project including hostname.
253 E.g., `git.example.com/org/project`.
254
255 .. var:: src_dir
256
257 The path to the source code, relative to the work dir. E.g.,
258 `src/git.example.com/org/project`.
Monty Taylor9e67bb72017-08-08 15:32:06 -0500259
James E. Blairb3d3f2b2017-09-27 12:04:55 -0700260 .. var:: required
261
262 A boolean indicating whether this project appears in the
263 :attr:`job.required-projects` list for this job.
264
James E. Blairbae8fec2017-11-21 10:19:06 -0800265 .. var:: checkout
266
267 The branch or tag that Zuul checked out for this project.
268 This may be influenced by the branch or tag associated with
269 the item as well as the job configuration.
270
Ian Wienand42234422017-10-23 16:03:53 +1100271 For example, to access the source directory of a single known
272 project, you might use::
273
274 {{ zuul.projects['git.example.com/org/project'].src_dir }}
275
276 To iterate over the project list, you might write a task
277 something like::
278
279 - name: Sample project iteration
280 debug:
281 msg: "Project {{ item.name }} is at {{ item.src_dir }}
282 with_items: {{ zuul.projects.values() | list }}
283
284
Ian Wienandd61d98e2017-10-18 08:21:19 +1100285 .. var:: _projects
286 :type: dict
287
288 The same as ``projects`` but a dictionary indexed by the
289 ``name`` value of each entry. ``projects`` will be converted to
290 this.
291
James E. Blaird9f0efb2017-08-02 16:07:44 -0700292 .. var:: tenant
293
294 The name of the current Zuul tenant.
295
James E. Blair93e57f72017-09-01 08:51:49 -0700296 .. var:: timeout
297
298 The job timeout, in seconds.
299
James E. Blaird9f0efb2017-08-02 16:07:44 -0700300 .. var:: jobtags
301
302 A list of tags associated with the job. Not to be confused with
303 git tags, these are simply free-form text fields that can be
304 used by the job for reporting or classification purposes.
305
306 .. var:: items
307 :type: list
308
309 A list of dictionaries, each representing an item being tested
310 with this change with the format:
311
312 .. var:: project
313
314 The item's project. This is a data structure with the
315 following fields:
316
317 .. var:: name
318
319 The name of the project, excluding hostname. E.g.,
320 `org/project`.
321
322 .. var:: short_name
323
324 The name of the project, excluding directories or
325 organizations. E.g., `project`.
326
327 .. var:: canonical_hostname
328
329 The canonical hostname where the project lives. E.g.,
330 `git.example.com`.
331
332 .. var:: canonical_name
333
334 The full canonical name of the project including hostname.
335 E.g., `git.example.com/org/project`.
336
Monty Taylor9e67bb72017-08-08 15:32:06 -0500337 .. var:: src_dir
338
339 The path to the source code on the remote host, relative
340 to the home dir of the remote user.
341 E.g., `src/git.example.com/org/project`.
342
James E. Blaird9f0efb2017-08-02 16:07:44 -0700343 .. var:: branch
344
345 The target branch of the change (without the `refs/heads/` prefix).
346
347 .. var:: change
348
349 The identifier for the change.
350
Monty Taylor41634442017-09-06 18:35:17 -0500351 .. var:: change_url
352
353 The URL to the source location of the given change.
354 E.g., `https://review.example.org/#/c/123456/` or
355 `https://github.com/example/example/pull/1234`.
356
James E. Blaird9f0efb2017-08-02 16:07:44 -0700357 .. var:: patchset
358
359 The patchset identifier for the change. If a change is
360 revised, this will have a different value.
James E. Blair21037782017-07-19 11:56:55 -0700361
Jesse Keatinga49ddaf2017-09-11 18:17:47 -0600362.. var:: zuul_success
363
364 Post run playbook(s) will be passed this variable to indicate if the run
365 phase of the job was successful or not. This variable is meant to be used
366 with the `boolean` filter.
367
368
James E. Blair21037782017-07-19 11:56:55 -0700369Change Items
370++++++++++++
371
372A change to the repository. Most often, this will be a git reference
373which has not yet been merged into the repository (e.g., a gerrit
374change or a GitHub pull request). The following additional variables
375are available:
376
James E. Blaird9f0efb2017-08-02 16:07:44 -0700377.. var:: zuul
378 :hidden:
James E. Blair21037782017-07-19 11:56:55 -0700379
James E. Blaird9f0efb2017-08-02 16:07:44 -0700380 .. var:: branch
James E. Blair21037782017-07-19 11:56:55 -0700381
James E. Blaird9f0efb2017-08-02 16:07:44 -0700382 The target branch of the change (without the `refs/heads/` prefix).
383
384 .. var:: change
385
386 The identifier for the change.
387
388 .. var:: patchset
389
390 The patchset identifier for the change. If a change is revised,
391 this will have a different value.
James E. Blair21037782017-07-19 11:56:55 -0700392
Monty Taylor41634442017-09-06 18:35:17 -0500393 .. var:: change_url
394
395 The URL to the source location of the given change.
396 E.g., `https://review.example.org/#/c/123456/` or
397 `https://github.com/example/example/pull/1234`.
398
James E. Blair21037782017-07-19 11:56:55 -0700399Branch Items
400++++++++++++
401
402This represents a branch tip. This item may have been enqueued
403because the branch was updated (via a change having merged, or a
404direct push). Or it may have been enqueued by a timer for the purpose
405of verifying the current condition of the branch. The following
406additional variables are available:
407
James E. Blaird9f0efb2017-08-02 16:07:44 -0700408.. var:: zuul
409 :hidden:
James E. Blair21037782017-07-19 11:56:55 -0700410
James E. Blaird9f0efb2017-08-02 16:07:44 -0700411 .. var:: branch
James E. Blair21037782017-07-19 11:56:55 -0700412
James E. Blaird9f0efb2017-08-02 16:07:44 -0700413 The name of the item's branch (without the `refs/heads/`
414 prefix).
415
416 .. var:: oldrev
417
418 If the item was enqueued as the result of a change merging or
419 being pushed to the branch, the git sha of the old revision will
420 be included here. Otherwise, this variable will be undefined.
421
422 .. var:: newrev
423
424 If the item was enqueued as the result of a change merging or
425 being pushed to the branch, the git sha of the new revision will
426 be included here. Otherwise, this variable will be undefined.
James E. Blair21037782017-07-19 11:56:55 -0700427
428Tag Items
429+++++++++
430
431This represents a git tag. The item may have been enqueued because a
432tag was created or deleted. The following additional variables are
433available:
434
James E. Blaird9f0efb2017-08-02 16:07:44 -0700435.. var:: zuul
436 :hidden:
James E. Blair21037782017-07-19 11:56:55 -0700437
James E. Blaird9f0efb2017-08-02 16:07:44 -0700438 .. var:: tag
James E. Blair21037782017-07-19 11:56:55 -0700439
James E. Blaird9f0efb2017-08-02 16:07:44 -0700440 The name of the item's tag (without the `refs/tags/` prefix).
441
442 .. var:: oldrev
443
444 If the item was enqueued as the result of a tag being deleted,
445 the previous git sha of the tag will be included here. If the
446 tag was created, this variable will be undefined.
447
448 .. var:: newrev
449
450 If the item was enqueued as the result of a tag being created,
451 the new git sha of the tag will be included here. If the tag
452 was deleted, this variable will be undefined.
James E. Blair21037782017-07-19 11:56:55 -0700453
454Ref Items
455+++++++++
456
457This represents a git reference that is neither a change, branch, or
458tag. Note that all items include a `ref` attribute which may be used
459to identify the ref. The following additional variables are
460available:
461
James E. Blaird9f0efb2017-08-02 16:07:44 -0700462.. var:: zuul
463 :hidden:
James E. Blair21037782017-07-19 11:56:55 -0700464
James E. Blaird9f0efb2017-08-02 16:07:44 -0700465 .. var:: oldrev
466
467 If the item was enqueued as the result of a ref being deleted,
468 the previous git sha of the ref will be included here. If the
469 ref was created, this variable will be undefined.
470
471 .. var:: newrev
472
473 If the item was enqueued as the result of a ref being created,
474 the new git sha of the ref will be included here. If the ref
475 was deleted, this variable will be undefined.
James E. Blair21037782017-07-19 11:56:55 -0700476
477Working Directory
478+++++++++++++++++
479
480Additionally, some information about the working directory and the
481executor running the job is available:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700482
James E. Blaird9f0efb2017-08-02 16:07:44 -0700483.. var:: zuul
484 :hidden:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700485
James E. Blaird9f0efb2017-08-02 16:07:44 -0700486 .. var:: executor
James E. Blaireff5a9d2017-06-20 00:00:37 -0700487
James E. Blaird9f0efb2017-08-02 16:07:44 -0700488 A number of values related to the executor running the job are
489 available:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700490
James E. Blaird9f0efb2017-08-02 16:07:44 -0700491 .. var:: hostname
492
493 The hostname of the executor.
494
495 .. var:: src_root
496
497 The path to the source directory.
498
499 .. var:: log_root
500
501 The path to the logs directory.
502
503 .. var:: work_root
504
505 The path to the working directory.
Jamie Lennox7655b552017-03-17 12:33:38 +1100506
507.. _user_sitewide_variables:
508
509Site-wide Variables
510~~~~~~~~~~~~~~~~~~~
511
512The Zuul administrator may define variables which will be available to
513all jobs running in the system. These are statically defined and may
514not be altered by jobs. See the :ref:`Administrator's Guide
515<admin_sitewide_variables>` for information on how a site
516administrator may define these variables.
517
James E. Blair698703c2017-09-15 20:58:30 -0600518Parent Job Results
519~~~~~~~~~~~~~~~~~~
520
521A job may return data to Zuul for later use by jobs which depend on
522it. For details, see :ref:`return_values`.
Jamie Lennox7655b552017-03-17 12:33:38 +1100523
James E. Blaireff5a9d2017-06-20 00:00:37 -0700524SSH Keys
525--------
526
527Zuul starts each job with an SSH agent running and the key used to
528access the job's nodes added to that agent. Generally you won't need
529to be aware of this since Ansible will use this when performing any
530tasks on remote nodes. However, under some circumstances you may want
531to interact with the agent. For example, you may wish to add a key
532provided as a secret to the job in order to access a specific host, or
533you may want to, in a pre-playbook, replace the key used to log into
534the assigned nodes in order to further protect it from being abused by
535untrusted job content.
536
537.. TODO: describe standard lib and link to published docs for it.
538
James E. Blair88e79c02017-07-07 13:36:54 -0700539.. _return_values:
540
James E. Blair196f61a2017-06-30 15:42:29 -0700541Return Values
542-------------
543
James E. Blair698703c2017-09-15 20:58:30 -0600544A job may return some values to Zuul to affect its behavior and for
545use by other jobs.. To return a value, use the ``zuul_return``
Tristan Cacquerayff47ff02017-12-13 08:51:58 +0000546Ansible module in a job playbook running on the executor 'localhost' node.
547For example:
James E. Blaird9f0efb2017-08-02 16:07:44 -0700548
549.. code-block:: yaml
James E. Blair196f61a2017-06-30 15:42:29 -0700550
551 tasks:
552 - zuul_return:
553 data:
554 foo: bar
555
James E. Blair698703c2017-09-15 20:58:30 -0600556Will return the dictionary ``{'foo': 'bar'}`` to Zuul.
James E. Blair196f61a2017-06-30 15:42:29 -0700557
558.. TODO: xref to section describing formatting
559
James E. Blair698703c2017-09-15 20:58:30 -0600560To set the log URL for a build, use *zuul_return* to set the
James E. Blaird9f0efb2017-08-02 16:07:44 -0700561**zuul.log_url** value. For example:
562
563.. code-block:: yaml
James E. Blair196f61a2017-06-30 15:42:29 -0700564
565 tasks:
566 - zuul_return:
567 data:
568 zuul:
569 log_url: http://logs.example.com/path/to/build/logs
James E. Blair698703c2017-09-15 20:58:30 -0600570
571Any values other than those in the ``zuul`` hierarchy will be supplied
572as Ansible variables to child jobs. These variables have less
573precedence than any other type of variable in Zuul, so be sure their
574names are not shared by any job variables. If more than one parent
575job returns the same variable, the value from the later job in the job
576graph will take precedence.