summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-03 23:03:28 +0000
committerGerrit Code Review <review@openstack.org>2019-01-03 23:03:28 +0000
commit2fd688352f5e220fda0dfc72b164144910670d95 (patch)
tree089fc9ec035a7d7d1661d5bad884f88777e11dda
parente15926faca535b0dbf35e2089e2ea10625f8a2e7 (diff)
parentaad0e17ddd64851ca4c9e77185c74bebcc049fba (diff)
Merge "Cache empty branch config to prevent spurious reconfig"3.4.0
-rw-r--r--tests/unit/test_configloader.py12
-rw-r--r--zuul/configloader.py12
2 files changed, 20 insertions, 4 deletions
diff --git a/tests/unit/test_configloader.py b/tests/unit/test_configloader.py
index 237f502..60cf2ab 100644
--- a/tests/unit/test_configloader.py
+++ b/tests/unit/test_configloader.py
@@ -244,6 +244,18 @@ class TestTenantGroups4(TenantParserTestCase):
244 cat_jobs = [job for job in self.gearman_server.jobs_history 244 cat_jobs = [job for job in self.gearman_server.jobs_history
245 if job.name == b'merger:cat'] 245 if job.name == b'merger:cat']
246 self.assertEqual(1, len(cat_jobs)) 246 self.assertEqual(1, len(cat_jobs))
247 old_layout = tenant.layout
248
249 # Check that creating a change in project1 doesn't cause a
250 # reconfiguration (due to a mistaken belief that we need to
251 # load config from it since there is none in memory).
252 A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
253 self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
254 self.waitUntilSettled()
255 tenant = self.sched.abide.tenants.get('tenant-one')
256 new_layout = tenant.layout
257
258 self.assertEqual(old_layout, new_layout)
247 259
248 260
249class TestTenantGroups5(TenantParserTestCase): 261class TestTenantGroups5(TenantParserTestCase):
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 87bb6db..3b2def4 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -1542,10 +1542,6 @@ class TenantParser(object):
1542 for project in itertools.chain( 1542 for project in itertools.chain(
1543 tenant.config_projects, tenant.untrusted_projects): 1543 tenant.config_projects, tenant.untrusted_projects):
1544 tpc = tenant.project_configs[project.canonical_name] 1544 tpc = tenant.project_configs[project.canonical_name]
1545 # If all config classes are excluded then do not request
1546 # any getFiles jobs.
1547 if not tpc.load_classes:
1548 continue
1549 # For each branch in the repo, get the zuul.yaml for that 1545 # For each branch in the repo, get the zuul.yaml for that
1550 # branch. Remember the branch and then implicitly add a 1546 # branch. Remember the branch and then implicitly add a
1551 # branch selector to each job there. This makes the 1547 # branch selector to each job there. This makes the
@@ -1556,6 +1552,14 @@ class TenantParser(object):
1556 branch): 1552 branch):
1557 # We already have this branch cached. 1553 # We already have this branch cached.
1558 continue 1554 continue
1555 if not tpc.load_classes:
1556 # If all config classes are excluded then do not
1557 # request any getFiles jobs, but cache the lack of
1558 # data so we know we've looked at this branch.
1559 abide.cacheUnparsedConfig(
1560 project.canonical_name,
1561 branch, model.UnparsedConfig())
1562 continue
1559 job = self.merger.getFiles( 1563 job = self.merger.getFiles(
1560 project.source.connection.connection_name, 1564 project.source.connection.connection_name,
1561 project.name, branch, 1565 project.name, branch,