Job-specific subst. in a job group's job list

Adding job-specific substitutions in a job group's job list
would result in JJB crashing with the following error:
  TypeError: unhashable type: 'dict'

This change adds the ability to add job-specific substitutions
in a job group's job list. It implements the same logic used by
a previous change (6ff1d69).

Change-Id: I059f38d0aa8a8947aaac75e0ddb34d392063ece3
This commit is contained in:
Mathieu Gagné 2013-08-20 18:53:58 -04:00
parent ca509654c3
commit 444b053f6a
2 changed files with 19 additions and 1 deletions

View File

@ -186,6 +186,17 @@ the Job Templates in the Job Group will be realized. For example::
Would cause the jobs `foo-python-26` and `foo-python-27` to be created
in Jekins.
The ``jobs:`` list can also allow for specifying job-specific
substitutions as follows::
- job-group:
name: job-group-name
jobs:
- '{name}-build':
pipeline-next: '{name}-upload'
- '{name}-upload':
pipeline-next: ''
.. _macro:
Macro

View File

@ -134,7 +134,13 @@ class YamlParser(object):
# see if it's a job group
group = self.getJobGroup(jobname)
if group:
for group_jobname in group['jobs']:
for group_jobspec in group['jobs']:
if isinstance(group_jobspec, dict):
group_jobname, group_jobparams = \
group_jobspec.items()[0]
else:
group_jobname = group_jobspec
group_jobparams = {}
job = self.getJob(group_jobname)
if job:
continue
@ -144,6 +150,7 @@ class YamlParser(object):
d.update(project)
d.update(jobparams)
d.update(group)
d.update(group_jobparams)
# Except name, since the group's name is not useful
d['name'] = project['name']
if template: