Merge "Revert "Continue reporting on URL format KeyError""
This commit is contained in:
commit
14e38b7f08
|
@ -1,33 +0,0 @@
|
||||||
pipelines:
|
|
||||||
- name: gate
|
|
||||||
manager: DependentPipelineManager
|
|
||||||
trigger:
|
|
||||||
gerrit:
|
|
||||||
- event: comment-added
|
|
||||||
approval:
|
|
||||||
- approved: 1
|
|
||||||
success:
|
|
||||||
gerrit:
|
|
||||||
verified: 2
|
|
||||||
submit: true
|
|
||||||
failure:
|
|
||||||
gerrit:
|
|
||||||
verified: -2
|
|
||||||
start:
|
|
||||||
gerrit:
|
|
||||||
verified: 0
|
|
||||||
precedence: high
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- name: log-path
|
|
||||||
success-pattern: foo{build.parameters[LOG_PATH]}bar
|
|
||||||
- name: nonexistent
|
|
||||||
success-pattern: foo{build.parameters[NONEXISTENT]}bar
|
|
||||||
|
|
||||||
projects:
|
|
||||||
- name: org/project1
|
|
||||||
gate:
|
|
||||||
- log-path
|
|
||||||
- name: org/project2
|
|
||||||
gate:
|
|
||||||
- nonexistent
|
|
|
@ -2683,44 +2683,6 @@ For CI problems and help debugging, contact ci@example.org"""
|
||||||
self.assertEqual('The merge failed! For more information...',
|
self.assertEqual('The merge failed! For more information...',
|
||||||
self.smtp_messages[0]['body'])
|
self.smtp_messages[0]['body'])
|
||||||
|
|
||||||
def test_build_parameter_in_report(self):
|
|
||||||
"""Check that a message is sent to a reporter when embedding a build
|
|
||||||
parameter"""
|
|
||||||
self.config.set('zuul', 'layout_config',
|
|
||||||
'tests/fixtures/layout-build-parameters.yaml')
|
|
||||||
self.sched.reconfigure(self.config)
|
|
||||||
self.registerJobs()
|
|
||||||
|
|
||||||
# Check the reported message is valid
|
|
||||||
A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
|
|
||||||
A.addApproval('CRVW', 2)
|
|
||||||
self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
|
|
||||||
self.waitUntilSettled()
|
|
||||||
|
|
||||||
self.assertEqual(1, len(self.history)) # 1 job
|
|
||||||
self.assertEqual(2, len(A.messages)) # 2 messages
|
|
||||||
|
|
||||||
self.assertIn('gate/log-path', A.messages[1])
|
|
||||||
|
|
||||||
def test_nonexistent_build_parameter_in_report(self):
|
|
||||||
"""Check that a message is sent to a reporter even when embedding a
|
|
||||||
nonexistent build parameter"""
|
|
||||||
self.config.set('zuul', 'layout_config',
|
|
||||||
'tests/fixtures/layout-build-parameters.yaml')
|
|
||||||
self.sched.reconfigure(self.config)
|
|
||||||
self.registerJobs()
|
|
||||||
|
|
||||||
# Check the reported message is valid
|
|
||||||
A = self.fake_gerrit.addFakeChange('org/project2', 'master', 'A')
|
|
||||||
A.addApproval('CRVW', 2)
|
|
||||||
self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
|
|
||||||
self.waitUntilSettled()
|
|
||||||
|
|
||||||
self.assertEqual(1, len(self.history)) # 1 job
|
|
||||||
self.assertEqual(2, len(A.messages)) # 2 messages
|
|
||||||
|
|
||||||
self.assertIn('NONEXISTENT', A.messages[1])
|
|
||||||
|
|
||||||
def test_swift_instructions(self):
|
def test_swift_instructions(self):
|
||||||
"Test that the correct swift instructions are sent to the workers"
|
"Test that the correct swift instructions are sent to the workers"
|
||||||
self.config.set('zuul', 'layout_config',
|
self.config.set('zuul', 'layout_config',
|
||||||
|
|
|
@ -1492,15 +1492,10 @@ class BasePipelineManager(object):
|
||||||
if job.failure_pattern:
|
if job.failure_pattern:
|
||||||
pattern = job.failure_pattern
|
pattern = job.failure_pattern
|
||||||
if pattern:
|
if pattern:
|
||||||
try:
|
url = pattern.format(change=item.change,
|
||||||
url = pattern.format(change=item.change,
|
pipeline=self.pipeline,
|
||||||
pipeline=self.pipeline,
|
job=job,
|
||||||
job=job,
|
build=build)
|
||||||
build=build)
|
|
||||||
except KeyError:
|
|
||||||
self.log.exception("Unknown key while formatting url %s" %
|
|
||||||
pattern)
|
|
||||||
url = pattern
|
|
||||||
else:
|
else:
|
||||||
url = build.url or job.name
|
url = build.url or job.name
|
||||||
if not job.voting:
|
if not job.voting:
|
||||||
|
|
Loading…
Reference in New Issue