Merge "Add tenant to url formatting." into feature/zuulv3

This commit is contained in:
Jenkins 2017-06-08 15:25:40 +00:00 committed by Gerrit Code Review
commit 9cdcc1a7b8
4 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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')

View File

@ -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'):

View File

@ -1578,11 +1578,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:
@ -2416,6 +2418,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):