summaryrefslogtreecommitdiff
path: root/zuul/source/__init__.py
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-11-09 16:22:34 -0800
committerJames E. Blair <jim@acmegating.com>2022-11-11 09:53:28 -0800
commit640059a67a68c8d2d9843765d586d7845e7648a9 (patch)
tree8771c29f38bd859bd55765a9e950a421508dfd82 /zuul/source/__init__.py
parent1245d100ca8ca3f206c33ecb9817a65daa65729d (diff)
downloadzuul-640059a67a68c8d2d9843765d586d7845e7648a9.tar.gz
Report a config error for unsupported merge mode
This updates the branch cache (and associated connection mixin) to include information about supported project merge modes. With this, if a project on github has the "squash" merge mode disabled and a Zuul user attempts to configure Zuul to use the "squash" mode, then Zuul will report a configuration syntax error. This change adds implementation support only to the github driver. Other drivers may add support in the future. For all other drivers, the branch cache mixin simply returns a value indicating that all merge modes are supported, so there will be no behavior change. This is also the upgrade strategy: the branch cache uses a defaultdict that reports all merge modes supported for any project when it first loads the cache from ZK after an upgrade. Change-Id: I3ed9a98dfc1ed63ac11025eb792c61c9a6414384
Diffstat (limited to 'zuul/source/__init__.py')
-rw-r--r--zuul/source/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/zuul/source/__init__.py b/zuul/source/__init__.py
index faf97b48b..dd11aa9b6 100644
--- a/zuul/source/__init__.py
+++ b/zuul/source/__init__.py
@@ -15,6 +15,8 @@
import abc
import time
+from zuul import model
+
class BaseSource(object, metaclass=abc.ABCMeta):
"""Base class for sources.
@@ -183,6 +185,20 @@ class BaseSource(object, metaclass=abc.ABCMeta):
"""
+ def getProjectMergeModes(self, project, tenant, min_ltime=-1):
+ """Get supported merge modes for a project
+
+ This method is called very frequently, and should generally
+ return quickly. The connection is expected to cache merge
+ modes for all projects queried.
+
+ The default implementation indicates that all merge modes are
+ supported.
+
+ """
+
+ return model.ALL_MERGE_MODES
+
@abc.abstractmethod
def getProjectBranchCacheLtime(self):
"""Return the current ltime of the project branch cache."""