James E. Blair 0ccf564937 Switch Zuul/JJB to use LOG_PATH
This calculates the full LOG_PATH in the Zuul config and pases it
to Jenkins.  The new path is similar to the old but with the
substitution of a short ZUUL_UUID at the end instead of the Jenkins
build number in order to avoid collisions from multiple Jenkins
masters.

Periodic jobs add a node name to their log path to avoid collisions
from multiple masters.  Unfortunately, that value is not accessible
to the logstash worker.  This can be solved by having Zuul trigger
periodic jobs.

Add the ZUUL_REF to logstash as "build_ref".

Requires https://review.openstack.org/#/c/39130/

Change-Id: I40bad59e3ad8ed6b4706762ed8b833fd15c13b0d
2013-07-29 17:47:08 -07:00

13 lines
531 B
Python

def set_log_url(item, job, params):
if hasattr(item.change, 'refspec'):
path = "%s/%s/%s/%s" % (
params['ZUUL_CHANGE'][-2:], params['ZUUL_CHANGE'],
params['ZUUL_PATCHSET'], params['ZUUL_PIPELINE'])
else:
path = "%s/%s/%s" % (
params['ZUUL_NEWREV'][:2], params['ZUUL_NEWREV'],
params['ZUUL_PIPELINE'])
params['BASE_LOG_PATH'] = path
params['LOG_PATH'] = path + '/%s/%s' % (job.name,
params['ZUUL_UUID'][:7])