Add more parameters to launcher.

So that the launcher can display/record useful information such as
pipeline, and included changes.

Change-Id: I8665c1d9df43030976f05ae7d7fe7529ccf56abf
Reviewed-on: https://review.openstack.org/11659
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2012-08-20 10:54:29 -07:00 committed by Jenkins
parent ceabcbca1b
commit 03b94ef5fa
2 changed files with 12 additions and 3 deletions

View File

@ -208,7 +208,7 @@ class Jenkins(object):
self.cleanup_thread.join()
#TODO: remove dependent_changes
def launch(self, job, change, dependent_changes=[]):
def launch(self, job, change, pipeline, dependent_changes=[]):
self.log.info("Launch job %s for change %s with dependent changes %s" %
(job, change, dependent_changes))
dependent_changes = dependent_changes[:]
@ -217,6 +217,7 @@ class Jenkins(object):
params = dict(UUID=uuid,
GERRIT_PROJECT=change.project.name,
ZUUL_PROJECT=change.project.name)
params['ZUUL_PIPELINE'] = pipeline.name
if hasattr(change, 'refspec'):
changes_str = '^'.join(
['%s:%s:%s' % (c.project.name, c.branch, c.refspec)
@ -224,8 +225,15 @@ class Jenkins(object):
params['GERRIT_BRANCH'] = change.branch
params['ZUUL_BRANCH'] = change.branch
params['GERRIT_CHANGES'] = changes_str
params['ZUUL_CHANGES'] = changes_str
params['ZUUL_REF'] = 'refs/zuul/%s/%s' % (change.branch,
change.current_build_set.ref)
zuul_changes = ' '.join(['%s,%s' % (c.number, c.patchset)
for c in dependent_changes + [change]])
params['ZUUL_CHANGE_IDS'] = zuul_changes
params['ZUUL_CHANGE'] = str(change.number)
params['ZUUL_PATCHSET'] = str(change.patchset)
if hasattr(change, 'ref'):
params['GERRIT_REFNAME'] = change.ref
params['ZUUL_REFNAME'] = change.ref
@ -233,6 +241,7 @@ class Jenkins(object):
params['ZUUL_OLDREV'] = change.oldrev
params['GERRIT_NEWREV'] = change.newrev
params['ZUUL_NEWREV'] = change.newrev
params['ZUUL_SHORT_NEWREV'] = change.newrev[:7]
if callable(job.parameter_function):
job.parameter_function(change, params)

View File

@ -497,7 +497,7 @@ class BasePipelineManager(object):
for job in self.pipeline.findJobsToRun(change):
self.log.debug("Found job %s for change %s" % (job, change))
try:
build = self.sched.launcher.launch(job, change)
build = self.sched.launcher.launch(job, change, self.pipeline)
self.building_jobs[build] = change
self.log.debug("Adding build %s of job %s to change %s" %
(build, job, change))
@ -775,7 +775,7 @@ class DependentPipelineManager(BasePipelineManager):
self.log.debug("Found job %s for change %s" % (job, change))
try:
#TODO: remove dependent_changes after GERRIT_CHANGES is gone
build = self.sched.launcher.launch(job, change,
build = self.sched.launcher.launch(job, change, self.pipeline,
dependent_changes)
self.building_jobs[build] = change
self.log.debug("Adding build %s of job %s to change %s" %