Merge "Fix wrong matched project template"

This commit is contained in:
Zuul 2018-08-10 02:47:39 +00:00 committed by Gerrit Code Review
commit 04524010a1
2 changed files with 31 additions and 1 deletions

View File

@ -5529,6 +5529,36 @@ class TestSchedulerTemplatedProject(ZuulTestCase):
self.getJobFromHistory('project-test1').
parameters['zuul']['_inheritance_path'])
# Now create a new branch named stable-foo and change the project
# pipeline
self.create_branch('untrusted-config', 'stable-foo')
self.fake_gerrit.addEvent(
self.fake_gerrit.getFakeBranchCreatedEvent(
'untrusted-config', 'stable-foo'))
self.waitUntilSettled()
in_repo_conf = textwrap.dedent(
"""
- project:
name: untrusted-config
templates:
- test-three-and-four
""")
file_dict = {'zuul.d/project.yaml': in_repo_conf}
B = self.fake_gerrit.addFakeChange('untrusted-config', 'stable-foo',
'B', files=file_dict)
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
self.assertHistory([
dict(name='project-test1', result='SUCCESS', changes='1,1'),
dict(name='project-test2', result='SUCCESS', changes='1,1'),
dict(name='layered-project-test3', result='SUCCESS',
changes='2,1'),
dict(name='layered-project-test4', result='SUCCESS',
changes='2,1'),
], ordered=False)
class TestSchedulerSuccessURL(ZuulTestCase):
tenant_config_file = 'config/success-url/main.yaml'

View File

@ -77,7 +77,7 @@ class ImpliedBranchMatcher(AbstractChangeMatcher):
def matches(self, change):
if hasattr(change, 'branch'):
if self.regex.match(change.branch):
if self.regex.fullmatch(change.branch):
return True
return False
return True