Add zuul.child_jobs in ansible inventory file
A job may want to know information about the first level of child jobs that will run after it, to provide this information we now include zuul.child_jobs (as list) in the inventory file. Change-Id: I17386d4aa1409b7ac996518981501c2d22899434 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
7d02357540
commit
144df5e2d5
@ -175,6 +175,11 @@ of item.
|
||||
configuration of items ahead in a dependent pipeline changes,
|
||||
Zuul creates a new buildset and restarts all of the jobs.
|
||||
|
||||
.. var:: child_jobs
|
||||
|
||||
A list of the first level child jobs to be run after this job
|
||||
has finished successfully.
|
||||
|
||||
.. var:: ref
|
||||
|
||||
The git ref of the item. This will be the full path (e.g.,
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new Ansible inventory variable :var:`zuul.child_jobs` which is a
|
||||
list of the first level child jobs to be run after a job has
|
||||
finished successfully.
|
@ -8,6 +8,13 @@
|
||||
- nodepool.region == 'test-region'
|
||||
- nodepool.provider == 'test-provider'
|
||||
|
||||
- name: Assert zuul variables are valid.
|
||||
assert:
|
||||
that:
|
||||
- zuul.child_jobs is defined
|
||||
- zuul.child_jobs|length == 1
|
||||
- "'check-hostvars' in zuul.child_jobs"
|
||||
|
||||
- name: Assert zuul-executor variables are valid.
|
||||
assert:
|
||||
that:
|
||||
@ -39,4 +46,4 @@
|
||||
- vartest_job == 'vartest_job'
|
||||
- vartest_secret.value == 'vartest_secret'
|
||||
- vartest_site == 'vartest_site'
|
||||
- base_var == 'base_var'
|
||||
- base_var == 'base_var'
|
||||
|
@ -15,8 +15,12 @@
|
||||
- python27
|
||||
- faillocal
|
||||
- check-vars
|
||||
- check-hostvars
|
||||
- check-secret-names
|
||||
- check-hostvars:
|
||||
dependencies:
|
||||
- check-vars
|
||||
- check-secret-names:
|
||||
dependencies:
|
||||
- check-hostvars
|
||||
- timeout
|
||||
- post-timeout
|
||||
- hello-world
|
||||
|
@ -182,6 +182,8 @@ class ExecutorClient(object):
|
||||
zuul_params['newrev'] = item.change.newrev
|
||||
zuul_params['projects'] = {} # Set below
|
||||
zuul_params['items'] = dependent_changes
|
||||
zuul_params['child_jobs'] = list(item.job_graph.getDirectDependentJobs(
|
||||
job.name))
|
||||
|
||||
params = dict()
|
||||
params['job'] = job.name
|
||||
|
@ -1394,7 +1394,7 @@ class JobGraph(object):
|
||||
def getJobs(self):
|
||||
return list(self.jobs.values()) # Report in the order of layout cfg
|
||||
|
||||
def _getDirectDependentJobs(self, parent_job):
|
||||
def getDirectDependentJobs(self, parent_job):
|
||||
ret = set()
|
||||
for dependent_name, parent_names in self._dependencies.items():
|
||||
if parent_job in parent_names:
|
||||
@ -1406,7 +1406,7 @@ class JobGraph(object):
|
||||
jobs_to_iterate = set([parent_job])
|
||||
while len(jobs_to_iterate) > 0:
|
||||
current_job = jobs_to_iterate.pop()
|
||||
current_dependent_jobs = self._getDirectDependentJobs(current_job)
|
||||
current_dependent_jobs = self.getDirectDependentJobs(current_job)
|
||||
new_dependent_jobs = current_dependent_jobs - all_dependent_jobs
|
||||
jobs_to_iterate |= new_dependent_jobs
|
||||
all_dependent_jobs |= new_dependent_jobs
|
||||
|
Loading…
x
Reference in New Issue
Block a user