Add tenant to url formatting.
Expose the tenant name to the executor and url formatter so that we can store logs per tenant. Change-Id: Ifad1ba668ee5b86e6c6f5cb71eae53ad8d49f3ff Signed-off-by: Jamie Lennox <jamielennox@gmail.com>
This commit is contained in:
parent
fcb00c5c6a
commit
bf997c8b46
|
@ -29,7 +29,7 @@
|
|||
github:
|
||||
comment: false
|
||||
status: 'success'
|
||||
status-url: http://logs.example.com/{pipeline.name}/{change.project}/{change.number}/{change.patchset}/
|
||||
status-url: http://logs.example.com/{tenant.name}/{pipeline.name}/{change.project}/{change.number}/{change.patchset}/
|
||||
failure:
|
||||
github:
|
||||
comment: false
|
||||
|
|
|
@ -300,8 +300,8 @@ class TestGithubDriver(ZuulTestCase):
|
|||
self.assertEqual('tenant-one/reporting', report_status['context'])
|
||||
self.assertEqual('success', report_status['state'])
|
||||
self.assertEqual(2, len(A.comments))
|
||||
report_url = ('http://logs.example.com/reporting/%s/%s/%s/' %
|
||||
(A.project, A.number, A.head_sha))
|
||||
report_url = ('http://logs.example.com/tenant-one/reporting/'
|
||||
'%s/%s/%s/' % (A.project, A.number, A.head_sha))
|
||||
self.assertEqual(report_url, report_status['url'])
|
||||
|
||||
@simple_layout('layouts/merging-github.yaml', driver='github')
|
||||
|
|
|
@ -196,6 +196,7 @@ class ExecutorClient(object):
|
|||
pipeline=pipeline.name,
|
||||
job=job.name,
|
||||
project=project,
|
||||
tenant=tenant.name,
|
||||
tags=' '.join(sorted(job.tags)))
|
||||
|
||||
if hasattr(item.change, 'branch'):
|
||||
|
|
|
@ -1588,11 +1588,13 @@ class QueueItem(object):
|
|||
# secrets, etc.
|
||||
safe_change = self.change.getSafeAttributes()
|
||||
safe_pipeline = self.pipeline.getSafeAttributes()
|
||||
safe_tenant = self.pipeline.layout.tenant.getSafeAttributes()
|
||||
safe_job = job.getSafeAttributes() if job else {}
|
||||
safe_build = build.getSafeAttributes() if build else {}
|
||||
try:
|
||||
url = url_pattern.format(change=safe_change,
|
||||
pipeline=safe_pipeline,
|
||||
tenant=safe_tenant,
|
||||
job=safe_job,
|
||||
build=safe_build)
|
||||
except KeyError as e:
|
||||
|
@ -2432,6 +2434,9 @@ class Tenant(object):
|
|||
self.untrusted_projects.append(project)
|
||||
self._addProject(project)
|
||||
|
||||
def getSafeAttributes(self):
|
||||
return Attributes(name=self.name)
|
||||
|
||||
|
||||
class Abide(object):
|
||||
def __init__(self):
|
||||
|
|
Loading…
Reference in New Issue