Items in extra paths should be loaded in dependent changes
If a change depends on a change of another repo, who has extra-dirs/files, the items were not loaded from those extra paths, because only the extra_config_files/dirs of the current repo was considered. Fix the issue by also take into account all the extra_config_files /dirs from the all the dependent repos. Change-Id: Ia50eed6c2c11b392fe83469453546a4b0928a769
This commit is contained in:
parent
d5385d7fc5
commit
b2cf5a0b66
|
@ -0,0 +1,2 @@
|
|||
- job:
|
||||
name: project2-private-extra-file
|
|
@ -0,0 +1,6 @@
|
|||
- project:
|
||||
name: org/project2
|
||||
check:
|
||||
jobs:
|
||||
- project2-private-extra-file
|
||||
- project2-private-extra-dir
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,2 @@
|
|||
- job:
|
||||
name: project2-private-extra-dir
|
|
@ -8,6 +8,10 @@
|
|||
- org/project
|
||||
- org/project1:
|
||||
exclude: project
|
||||
- org/project2:
|
||||
extra-config-paths:
|
||||
- .extra.yaml
|
||||
- extra.d/
|
||||
|
||||
- tenant:
|
||||
name: tenant-two
|
||||
|
|
|
@ -2848,6 +2848,41 @@ class TestInRepoConfigDir(ZuulTestCase):
|
|||
], ordered=True)
|
||||
|
||||
|
||||
class TestExtraConfigInDependent(ZuulTestCase):
|
||||
# in org/project2, jobs are defined in extra config paths, while
|
||||
# project is defined in .zuul.yaml
|
||||
tenant_config_file = 'config/in-repo-dir/main.yaml'
|
||||
scheduler_count = 1
|
||||
|
||||
def test_extra_config_in_dependent_change(self):
|
||||
# Test that when jobs are defined in a extra-config-paths in a repo, if
|
||||
# another change is dependent on a change of that repo, the jobs should
|
||||
# still be loaded.
|
||||
|
||||
# Add an empty zuul.yaml here so we are triggering dynamic layout load
|
||||
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A',
|
||||
files={'zuul.yaml': ''})
|
||||
B = self.fake_gerrit.addFakeChange('org/project2', 'master', 'B',
|
||||
files={'zuul.yaml': ''})
|
||||
# A Depends-On: B who has private jobs defined in extra-config-paths
|
||||
A.data['commitMessage'] = '%s\n\nDepends-On: %s\n' % (
|
||||
A.subject, B.data['url'])
|
||||
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
# Jobs in both changes should be success
|
||||
self.assertHistory([
|
||||
dict(name='project2-private-extra-file', result='SUCCESS',
|
||||
changes='2,1'),
|
||||
dict(name='project2-private-extra-dir', result='SUCCESS',
|
||||
changes='2,1'),
|
||||
dict(name='project-test1', result='SUCCESS',
|
||||
changes='2,1 1,1'),
|
||||
], ordered=False)
|
||||
|
||||
|
||||
class TestGlobalRepoState(AnsibleZuulTestCase):
|
||||
config_file = 'zuul-connections-gerrit-and-github.conf'
|
||||
tenant_config_file = 'config/global-repo-state/main.yaml'
|
||||
|
|
|
@ -1301,12 +1301,23 @@ class PipelineManager(metaclass=ABCMeta):
|
|||
item.bundle and
|
||||
item.bundle.updatesConfig(tenant) and tpc is not None
|
||||
):
|
||||
extra_config_files = set(tpc.extra_config_files)
|
||||
extra_config_dirs = set(tpc.extra_config_dirs)
|
||||
# Merge extra_config_files and extra_config_dirs of the
|
||||
# dependent change
|
||||
for item_ahead in item.items_ahead:
|
||||
tpc_ahead = tenant.project_configs.get(
|
||||
item_ahead.change.project.canonical_name)
|
||||
if tpc_ahead:
|
||||
extra_config_files.update(tpc_ahead.extra_config_files)
|
||||
extra_config_dirs.update(tpc_ahead.extra_config_dirs)
|
||||
|
||||
ready = self.scheduleMerge(
|
||||
item,
|
||||
files=(['zuul.yaml', '.zuul.yaml'] +
|
||||
list(tpc.extra_config_files)),
|
||||
list(extra_config_files)),
|
||||
dirs=(['zuul.d', '.zuul.d'] +
|
||||
list(tpc.extra_config_dirs)))
|
||||
list(extra_config_dirs)))
|
||||
if build_set.merge_state == build_set.PENDING:
|
||||
ready = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue