Fix repo state branches for branch/ref items
With the recent optimization in I052aaf86981bbd3d7300c5dcfc374dbad93ab1c1 we started using the merger-items instead of the repo state to decide which projects need to be included when scheduling the global repo state. When unprotected branches are excluded, this caused problems for some branch/ref items for which we skip the initial repo state. The merger-items itself were still included in the list of items later on, but we did not consider the branches for those items. The effect was, that some branches were no longer included in the repo state. Change-Id: I0e34a53ab015116759605973ebb72b88c5682c31
This commit is contained in:
@@ -1542,12 +1542,23 @@ class PipelineManager(metaclass=ABCMeta):
|
||||
|
||||
# Filter projects for ones that are already in repo state
|
||||
connections = self.sched.connections.connections
|
||||
for merger_item in item.current_build_set.merger_items:
|
||||
canonical_hostname = connections[
|
||||
merger_item['connection']].canonical_hostname
|
||||
canonical_project_name = (canonical_hostname + '/' +
|
||||
merger_item['project'])
|
||||
project_cnames.discard(canonical_project_name)
|
||||
|
||||
new_items = list()
|
||||
build_set = item.current_build_set
|
||||
|
||||
# If we skipped the initial repo state (for branch/ref items),
|
||||
# we need to include the merger items for the final repo state.
|
||||
# MODEL_API < 28
|
||||
if (build_set._merge_repo_state_path is None and
|
||||
not build_set.repo_state_keys):
|
||||
new_items.extend(build_set.merger_items)
|
||||
else:
|
||||
for merger_item in item.current_build_set.merger_items:
|
||||
canonical_hostname = connections[
|
||||
merger_item['connection']].canonical_hostname
|
||||
canonical_project_name = (canonical_hostname + '/' +
|
||||
merger_item['project'])
|
||||
project_cnames.discard(canonical_project_name)
|
||||
|
||||
if not project_cnames:
|
||||
item.current_build_set.updateAttributes(
|
||||
@@ -1569,15 +1580,6 @@ class PipelineManager(metaclass=ABCMeta):
|
||||
branches = self._branchesForRepoState(
|
||||
projects=projects, tenant=tenant, items=[item])
|
||||
|
||||
new_items = list()
|
||||
build_set = item.current_build_set
|
||||
# If we skipped the initial repo state (for branch/ref items),
|
||||
# we need to include the merger items for the final repo state.
|
||||
# MODEL_API < 28
|
||||
if (build_set._merge_repo_state_path is None and
|
||||
not build_set.repo_state_keys):
|
||||
new_items.extend(build_set.merger_items)
|
||||
|
||||
for project in projects:
|
||||
new_item = dict()
|
||||
new_item['project'] = project.name
|
||||
|
||||
Reference in New Issue
Block a user