Add comments about base jobs

This addresses some review nits from I26ffddad8358c156cfac749ce98af70f3447f671.

Change-Id: Ifea1aa75e78192b038329951146066759a6ab2c6
This commit is contained in:
James E. Blair 2017-08-08 12:44:59 -07:00
parent 2bab6e7361
commit effb1dbcf2
2 changed files with 9 additions and 1 deletions

View File

@ -16,7 +16,7 @@
parent: null
tags:
- mybase
- job:
name: other-base
parent: null

View File

@ -444,13 +444,21 @@ class JobParser(object):
is_variant = layout.hasJob(conf['name'])
if 'parent' in conf:
if conf['parent'] is not None:
# Parent job is explicitly specified, so inherit from it.
parent = layout.getJob(conf['parent'])
job.inheritFrom(parent)
else:
# Parent is explicitly set as None, so user intends
# this to be a base job. That's only okay if we're in
# a config project.
if not conf['_source_context'].trusted:
raise Exception(
"Base jobs must be defined in config projects")
else:
# Parent is not explicitly set, so inherit from the
# default -- but only if this is the primary definition
# for the job (ie, not a variant -- variants don't need to
# have a parent as long as the main job does).
if not is_variant:
parent = layout.getJob(tenant.default_base_job)
job.inheritFrom(parent)