Merge "Fix implicit role for repos named ansible"
This commit is contained in:
commit
0101a37c18
|
@ -0,0 +1,8 @@
|
|||
- job:
|
||||
name: hello-ansible
|
||||
run: playbooks/hello-ansible.yaml
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- hello-ansible
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,5 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: hello
|
||||
debug:
|
||||
msg: hello ansible
|
|
@ -8,3 +8,4 @@
|
|||
- org/project
|
||||
- org/plugin-project
|
||||
- bare-role
|
||||
- org/ansible
|
||||
|
|
|
@ -2109,6 +2109,17 @@ class TestAnsible(AnsibleZuulTestCase):
|
|||
self.assertIn(fail.format("timeout", build_timeout.uuid), msg)
|
||||
self.assertIn(fail.format("failpost", build_failpost.uuid), msg)
|
||||
|
||||
def test_repo_ansible(self):
|
||||
A = self.fake_gerrit.addFakeChange('org/ansible', 'master', 'A')
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.assertEqual(A.reported, 1,
|
||||
"A should report success")
|
||||
self.assertHistory([
|
||||
dict(name='hello-ansible', result='SUCCESS', changes='1,1'),
|
||||
])
|
||||
|
||||
def _add_job(self, job_name):
|
||||
conf = textwrap.dedent(
|
||||
"""
|
||||
|
|
|
@ -810,7 +810,7 @@ class JobParser(object):
|
|||
def _makeImplicitRole(self, job):
|
||||
project = job.source_context.project
|
||||
name = project.name.split('/')[-1]
|
||||
name = JobParser.ANSIBLE_ROLE_RE.sub('', name)
|
||||
name = JobParser.ANSIBLE_ROLE_RE.sub('', name) or name
|
||||
return model.ZuulRole(name,
|
||||
project.canonical_name,
|
||||
implicit=True)
|
||||
|
|
Loading…
Reference in New Issue