summaryrefslogtreecommitdiff
path: root/zuul/manager/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'zuul/manager/__init__.py')
-rw-r--r--zuul/manager/__init__.py33
1 files changed, 20 insertions, 13 deletions
diff --git a/zuul/manager/__init__.py b/zuul/manager/__init__.py
index 836b7bb50..ee0f2c241 100644
--- a/zuul/manager/__init__.py
+++ b/zuul/manager/__init__.py
@@ -13,6 +13,7 @@
import logging
import textwrap
import urllib
+from abc import ABCMeta
from zuul import exceptions
from zuul import model
@@ -43,7 +44,7 @@ class StaticChangeQueueContextManager(object):
pass
-class PipelineManager(object):
+class PipelineManager(metaclass=ABCMeta):
"""Abstract Base Class for enqueing and processing Changes in a Pipeline"""
def __init__(self, sched, pipeline):
@@ -520,13 +521,14 @@ class PipelineManager(object):
return relevant_errors
def _loadDynamicLayout(self, item):
+ log = get_annotated_logger(self.log, item.event)
# Load layout
# Late import to break an import loop
import zuul.configloader
loader = zuul.configloader.ConfigLoader(
self.sched.connections, self.sched, None, None)
- self.log.debug("Loading dynamic layout")
+ log.debug("Loading dynamic layout")
(trusted_updates, untrusted_updates) = item.includesConfigUpdates()
build_set = item.current_build_set
@@ -540,23 +542,25 @@ class PipelineManager(object):
# catch syntax errors in config repos even though we won't
# actually run with that config.
if trusted_updates:
- self.log.debug("Loading dynamic layout (phase 1)")
+ log.debug("Loading dynamic layout (phase 1)")
trusted_layout = loader.createDynamicLayout(
item.pipeline.tenant,
build_set.files,
self.sched.ansible_manager,
- include_config_projects=True)
+ include_config_projects=True,
+ zuul_event_id=None)
trusted_errors = len(trusted_layout.loading_errors) > 0
# Then create the config a second time but without changes
# to config repos so that we actually use this config.
if untrusted_updates:
- self.log.debug("Loading dynamic layout (phase 2)")
+ log.debug("Loading dynamic layout (phase 2)")
untrusted_layout = loader.createDynamicLayout(
item.pipeline.tenant,
build_set.files,
self.sched.ansible_manager,
- include_config_projects=False)
+ include_config_projects=False,
+ zuul_event_id=None)
untrusted_errors = len(untrusted_layout.loading_errors) > 0
# Configuration state handling switchboard. Intentionally verbose
@@ -567,12 +571,12 @@ class PipelineManager(object):
# No errors found at all use dynamic untrusted layout
if (trusted_layout and not trusted_errors and
untrusted_layout and not untrusted_errors):
- self.log.debug("Loading dynamic layout complete")
+ log.debug("Loading dynamic layout complete")
return untrusted_layout
# No errors in untrusted only layout update
elif (not trusted_layout and
untrusted_layout and not untrusted_errors):
- self.log.debug("Loading dynamic layout complete")
+ log.debug("Loading dynamic layout complete")
return untrusted_layout
# No errors in trusted only layout update
elif (not untrusted_layout and
@@ -580,12 +584,12 @@ class PipelineManager(object):
# We're a change to a config repo (with no untrusted
# config items ahead), so just use the current pipeline
# layout.
- self.log.debug("Loading dynamic layout complete")
+ log.debug("Loading dynamic layout complete")
return item.queue.pipeline.tenant.layout
# Untrusted layout only works with trusted updates
elif (trusted_layout and not trusted_errors and
untrusted_layout and untrusted_errors):
- self.log.info("Configuration syntax error in dynamic layout")
+ log.info("Configuration syntax error in dynamic layout")
# The config is good if we include config-projects,
# but is currently invalid if we omit them. Instead
# of returning the whole error message, just leave a
@@ -610,7 +614,7 @@ class PipelineManager(object):
if relevant_errors:
item.setConfigErrors(relevant_errors)
return None
- self.log.info(
+ log.info(
"Configuration syntax error not related to "
"change context. Error won't be reported.")
return untrusted_layout
@@ -624,7 +628,7 @@ class PipelineManager(object):
if relevant_errors:
item.setConfigErrors(relevant_errors)
return None
- self.log.info(
+ log.info(
"Configuration syntax error not related to "
"change context. Error won't be reported.")
# We're a change to a config repo with errors not relevant
@@ -635,7 +639,7 @@ class PipelineManager(object):
"not accounted for.")
except Exception:
- self.log.exception("Error in dynamic layout")
+ log.exception("Error in dynamic layout")
item.setConfigError("Unknown configuration error")
return None
@@ -649,6 +653,9 @@ class PipelineManager(object):
def getLayout(self, item):
if item.item_ahead:
fallback_layout = item.item_ahead.layout
+ if fallback_layout is None:
+ # We're probably waiting on a merge job for the item ahead.
+ return None
else:
fallback_layout = item.pipeline.tenant.layout
if not item.change.updatesConfig(item.pipeline.tenant):