Merge "Revert "Continue reporting on URL format KeyError""

This commit is contained in:
Jenkins 2014-08-11 19:39:35 +00:00 committed by Gerrit Code Review
commit 14e38b7f08
3 changed files with 4 additions and 80 deletions

View File

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

View File

@ -2683,44 +2683,6 @@ For CI problems and help debugging, contact ci@example.org"""
self.assertEqual('The merge failed! For more information...',
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):
"Test that the correct swift instructions are sent to the workers"
self.config.set('zuul', 'layout_config',

View File

@ -1492,15 +1492,10 @@ class BasePipelineManager(object):
if job.failure_pattern:
pattern = job.failure_pattern
if pattern:
try:
url = pattern.format(change=item.change,
pipeline=self.pipeline,
job=job,
build=build)
except KeyError:
self.log.exception("Unknown key while formatting url %s" %
pattern)
url = pattern
url = pattern.format(change=item.change,
pipeline=self.pipeline,
job=job,
build=build)
else:
url = build.url or job.name
if not job.voting: