Fix layout generation for trusted projects
There was a bug introduced by the new handling of non live items in independent pipeline queues where a trusted project would not find a proper layout if it depended on another change. Address this by having the trusted project use the existing pipeline layout if there are no untrusted config updates ahead of it. This also adds a test for this case and updates the default single-tenant config to run tests against common-config, the trusted project. Change-Id: I7c0abe2c12423e003a135fa2108a2938d5b0186a
This commit is contained in:
parent
8c88420b04
commit
7e875721a9
|
@ -167,3 +167,25 @@
|
|||
dependencies: project-merge
|
||||
- project1-project2-integration:
|
||||
dependencies: project-merge
|
||||
|
||||
- project:
|
||||
name: common-config
|
||||
check:
|
||||
jobs:
|
||||
- project-merge
|
||||
- project-test1:
|
||||
dependencies: project-merge
|
||||
- project-test2:
|
||||
dependencies: project-merge
|
||||
- project1-project2-integration:
|
||||
dependencies: project-merge
|
||||
gate:
|
||||
queue: integrated
|
||||
jobs:
|
||||
- project-merge
|
||||
- project-test1:
|
||||
dependencies: project-merge
|
||||
- project-test2:
|
||||
dependencies: project-merge
|
||||
- project1-project2-integration:
|
||||
dependencies: project-merge
|
||||
|
|
|
@ -4864,6 +4864,27 @@ For CI problems and help debugging, contact ci@example.org"""
|
|||
dict(name='child-job', result='SUCCESS', changes='4,1'),
|
||||
])
|
||||
|
||||
def test_trusted_project_dep_on_non_live_untrusted_project(self):
|
||||
# Test we get a layout for trusted projects when they depend on
|
||||
# non live untrusted projects. This checks against a bug where
|
||||
# trusted project config changes can end up in a infinite loop
|
||||
# trying to find the right layout.
|
||||
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
|
||||
files = {'zuul.yaml': ''}
|
||||
B = self.fake_gerrit.addFakeChange('common-config', 'master', 'B',
|
||||
files=files)
|
||||
B.setDependsOn(A, 1)
|
||||
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.assertHistory([
|
||||
dict(name='project-merge', result='SUCCESS', changes='1,1 2,1'),
|
||||
dict(name='project-test1', result='SUCCESS', changes='1,1 2,1'),
|
||||
dict(name='project-test2', result='SUCCESS', changes='1,1 2,1'),
|
||||
dict(name='project1-project2-integration',
|
||||
result='SUCCESS', changes='1,1 2,1'),
|
||||
], ordered=False)
|
||||
|
||||
|
||||
class TestExecutor(ZuulTestCase):
|
||||
tenant_config_file = 'config/single-tenant/main.yaml'
|
||||
|
|
|
@ -445,12 +445,9 @@ class PipelineManager(object):
|
|||
include_config_projects=False)
|
||||
else:
|
||||
# We're a change to a config repo (with no untrusted
|
||||
# items ahead), so just use the most recently
|
||||
# generated layout.
|
||||
if item.item_ahead:
|
||||
return item.item_ahead.layout
|
||||
else:
|
||||
return item.queue.pipeline.layout
|
||||
# config items ahead), so just use the current pipeline
|
||||
# layout.
|
||||
return item.queue.pipeline.layout
|
||||
self.log.debug("Loading dynamic layout complete")
|
||||
except zuul.configloader.ConfigurationSyntaxError as e:
|
||||
self.log.info("Configuration syntax error in dynamic layout")
|
||||
|
|
Loading…
Reference in New Issue