Add a short name to the project in the inventory
There are times in jobs when we need just the repo name without any orgs or hostnames or whatnot. While it can be split in jinja, doing so is ugly when we can do it in python and pass it in. Change-Id: I4086eb2ccd64a450af7895bb150413deee463658
This commit is contained in:
parent
88c188d8d0
commit
299f94bbe0
|
@ -175,6 +175,10 @@ All items provide the following information as Ansible variables:
|
|||
**zuul.project.name**
|
||||
The name of the project, excluding hostname. E.g., `org/project`.
|
||||
|
||||
**zuul.project.short_name**
|
||||
The name of the project, excluding directories or organizations.
|
||||
E.g., `project`.
|
||||
|
||||
**zuul.project.canonical_hostname**
|
||||
The canonical hostname where the project lives. E.g.,
|
||||
`git.example.com`.
|
||||
|
@ -198,21 +202,25 @@ All items provide the following information as Ansible variables:
|
|||
|
||||
**project.name**
|
||||
The name of the project, excluding hostname. E.g., `org/project`.
|
||||
|
||||
|
||||
**project.short_name**
|
||||
The name of the project, excluding directories or organizations.
|
||||
E.g., `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.
|
||||
|
|
|
@ -152,6 +152,7 @@ class ExecutorClient(object):
|
|||
# replace the environment variables below.
|
||||
project = dict(
|
||||
name=item.change.project.name,
|
||||
short_name=item.change.project.name.split('/')[-1],
|
||||
canonical_hostname=item.change.project.canonical_hostname,
|
||||
canonical_name=item.change.project.canonical_name)
|
||||
|
||||
|
@ -181,6 +182,7 @@ class ExecutorClient(object):
|
|||
d = dict()
|
||||
d['project'] = dict(
|
||||
name=i.change.project.name,
|
||||
short_name=i.change.project.name.split('/')[-1],
|
||||
canonical_hostname=i.change.project.canonical_hostname,
|
||||
canonical_name=i.change.project.canonical_name)
|
||||
if hasattr(i.change, 'number'):
|
||||
|
|
Loading…
Reference in New Issue