Merge "Remove job trees from pipelines" into feature/zuulv3
This commit is contained in:
commit
24e6bff0b9
|
@ -207,7 +207,7 @@ class TestJob(BaseTestCase):
|
|||
]
|
||||
}
|
||||
}])
|
||||
layout.addProjectConfig(project_config, update_pipeline=False)
|
||||
layout.addProjectConfig(project_config)
|
||||
|
||||
change = model.Change(project)
|
||||
# Test master
|
||||
|
@ -416,7 +416,7 @@ class TestJob(BaseTestCase):
|
|||
]
|
||||
}
|
||||
}])
|
||||
layout.addProjectConfig(project_config, update_pipeline=False)
|
||||
layout.addProjectConfig(project_config)
|
||||
|
||||
change = model.Change(project)
|
||||
change.branch = 'master'
|
||||
|
@ -481,7 +481,7 @@ class TestJob(BaseTestCase):
|
|||
]
|
||||
}
|
||||
}])
|
||||
layout.addProjectConfig(project_config, update_pipeline=False)
|
||||
layout.addProjectConfig(project_config)
|
||||
|
||||
change = model.Change(project)
|
||||
change.branch = 'master'
|
||||
|
|
|
@ -251,9 +251,12 @@ class TestScheduler(ZuulTestCase):
|
|||
C.addApproval('code-review', 2)
|
||||
|
||||
self.fake_gerrit.addEvent(A.addApproval('approved', 1))
|
||||
self.fake_gerrit.addEvent(B.addApproval('approved', 1))
|
||||
self.fake_gerrit.addEvent(C.addApproval('approved', 1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.fake_gerrit.addEvent(B.addApproval('approved', 1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.fake_gerrit.addEvent(C.addApproval('approved', 1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
# There should be one merge job at the head of each queue running
|
||||
|
|
|
@ -925,5 +925,5 @@ class ConfigLoader(object):
|
|||
|
||||
for config_project in config.projects.values():
|
||||
layout.addProjectConfig(ProjectParser.fromYaml(
|
||||
tenant, layout, config_project), update_pipeline=False)
|
||||
tenant, layout, config_project))
|
||||
return layout
|
||||
|
|
|
@ -91,11 +91,13 @@ class PipelineManager(object):
|
|||
log_jobs(x, indent + 2)
|
||||
|
||||
for project_name in layout.project_configs.keys():
|
||||
project = self.pipeline.source.getProject(project_name)
|
||||
tree = self.pipeline.getJobTree(project)
|
||||
if tree:
|
||||
self.log.info(" %s" % project)
|
||||
log_jobs(tree)
|
||||
project_config = layout.project_configs.get(project_name)
|
||||
if project_config:
|
||||
project_pipeline_config = project_config.pipelines.get(
|
||||
self.pipeline.name)
|
||||
if project_pipeline_config:
|
||||
self.log.info(" %s" % project_name)
|
||||
log_jobs(project_pipeline_config.job_tree)
|
||||
self.log.info(" On start:")
|
||||
self.log.info(" %s" % self.pipeline.start_actions)
|
||||
self.log.info(" On success:")
|
||||
|
|
|
@ -39,10 +39,12 @@ class DependentPipelineManager(PipelineManager):
|
|||
change_queues = {}
|
||||
project_configs = self.pipeline.layout.project_configs
|
||||
|
||||
for project in self.pipeline.getProjects():
|
||||
project_config = project_configs[project.name]
|
||||
project_pipeline_config = project_config.pipelines[
|
||||
self.pipeline.name]
|
||||
for project_config in project_configs.values():
|
||||
project_pipeline_config = project_config.pipelines.get(
|
||||
self.pipeline.name)
|
||||
if project_pipeline_config is None:
|
||||
continue
|
||||
project = self.pipeline.source.getProject(project_config.name)
|
||||
queue_name = project_pipeline_config.queue_name
|
||||
if queue_name and queue_name in change_queues:
|
||||
change_queue = change_queues[queue_name]
|
||||
|
|
|
@ -123,7 +123,6 @@ class Pipeline(object):
|
|||
self.start_message = None
|
||||
self.dequeue_on_new_patchset = True
|
||||
self.ignore_dependencies = False
|
||||
self.job_trees = {} # project -> JobTree
|
||||
self.manager = None
|
||||
self.queues = []
|
||||
self.precedence = PRECEDENCE_NORMAL
|
||||
|
@ -160,13 +159,6 @@ class Pipeline(object):
|
|||
def setManager(self, manager):
|
||||
self.manager = manager
|
||||
|
||||
def getProjects(self):
|
||||
# cmp is not in python3, applied idiom from
|
||||
# http://python-future.org/compatible_idioms.html#cmp
|
||||
return sorted(
|
||||
self.job_trees.keys(),
|
||||
key=lambda p: p.name)
|
||||
|
||||
def addQueue(self, queue):
|
||||
self.queues.append(queue)
|
||||
|
||||
|
@ -179,10 +171,6 @@ class Pipeline(object):
|
|||
def removeQueue(self, queue):
|
||||
self.queues.remove(queue)
|
||||
|
||||
def getJobTree(self, project):
|
||||
tree = self.job_trees.get(project)
|
||||
return tree
|
||||
|
||||
def getChangesInQueue(self):
|
||||
changes = []
|
||||
for shared_queue in self.queues:
|
||||
|
@ -2170,18 +2158,8 @@ class Layout(object):
|
|||
def addProjectTemplate(self, project_template):
|
||||
self.project_templates[project_template.name] = project_template
|
||||
|
||||
def addProjectConfig(self, project_config, update_pipeline=True):
|
||||
def addProjectConfig(self, project_config):
|
||||
self.project_configs[project_config.name] = project_config
|
||||
# TODOv3(jeblair): tidy up the relationship between pipelines
|
||||
# and projects and projectconfigs. Specifically, move
|
||||
# job_trees out of the pipeline since they are more dynamic
|
||||
# than pipelines. Remove the update_pipeline argument
|
||||
if not update_pipeline:
|
||||
return
|
||||
for pipeline_name, pipeline_config in project_config.pipelines.items():
|
||||
pipeline = self.pipelines[pipeline_name]
|
||||
project = pipeline.source.getProject(project_config.name)
|
||||
pipeline.job_trees[project] = pipeline_config.job_tree
|
||||
|
||||
def _createJobTree(self, change, job_trees, parent):
|
||||
for tree in job_trees:
|
||||
|
|
Loading…
Reference in New Issue