diff --git a/doc/source/user/jobs.rst b/doc/source/user/jobs.rst index 0b2225268a..eefb2610ce 100644 --- a/doc/source/user/jobs.rst +++ b/doc/source/user/jobs.rst @@ -171,11 +171,30 @@ All items provide the following information as Ansible variables: job for reporting or classification purposes. **zuul.items** - A data structure representing the items being tested with this - change. -.. TODO: implement and document items + A list of dictionaries, each representing an item being tested with + this change with the format: + **project.name** + The name of the project, excluding hostname. E.g., `org/project`. + + **project.canonical_hostname** + The canonical hostname where the project lives. E.g., + `git.example.com`. + + **project.canonical_name** + The full canonical name of the project including hostname. E.g., + `git.example.com/org/project`. + + **branch** + The target branch of the change (without the `refs/heads/` prefix). + + **change** + The identifier for the change. + + **patchset** + The patchset identifier for the change. If a change is revised, + this will have a different value. Change Items ++++++++++++ diff --git a/zuul/executor/client.py b/zuul/executor/client.py index c668ca0df0..52cc403b38 100644 --- a/zuul/executor/client.py +++ b/zuul/executor/client.py @@ -175,6 +175,20 @@ class ExecutorClient(object): zuul_params['oldrev'] = item.change.oldrev if hasattr(item.change, 'newrev'): zuul_params['newrev'] = item.change.newrev + zuul_params['items'] = [] + for i in all_items: + d = dict() + d['project'] = dict( + name=i.change.project.name, + canonical_hostname=i.change.project.canonical_hostname, + canonical_name=i.change.project.canonical_name) + if hasattr(i.change, 'number'): + d['change'] = i.change.number + if hasattr(i.change, 'patchset'): + d['patchset'] = i.change.number + if hasattr(i.change, 'branch'): + d['branch'] = i.change.branch + zuul_params['items'].append(d) # Legacy environment variables params = dict(ZUUL_UUID=uuid,