Merge "Fix layout generation for trusted projects"

This commit is contained in:
Zuul
2018-05-02 16:15:12 +00:00
committed by Gerrit Code Review
3 changed files with 46 additions and 6 deletions

View File

@@ -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

View File

@@ -4897,6 +4897,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'

View File

@@ -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")