summaryrefslogtreecommitdiff
path: root/zuul/change_matcher.py
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-04-26 11:02:17 -0700
committerJames E. Blair <jim@acmegating.com>2022-04-26 11:02:17 -0700
commit77524b359cf427bca16d2a3339be9c1976755bc8 (patch)
treea7227332e6e16b9bf1a35c3a9d8fb035845e0393 /zuul/change_matcher.py
parent5a92b300338b5afd7cde177d306d7335206667f2 (diff)
downloadzuul-77524b359cf427bca16d2a3339be9c1976755bc8.tar.gz
Fix reporting certain config syntax errors5.2.5
Change I0421c5a446d0b75194096b1d8f0e0866dae3b8f0 began including BranchMatcher objects instead of strings in the SourceContext class if an implied-branches pragma was supplied. If a syntax error occurs in a repo with such a pragma, the source context needs to be serialized to zk, and that would fail. To correct this, add serialization methods to the source context and branch matchers. Also correct an unrelated error where the syntax "- job:" would fail to report the error to the user because the value None was added to the list of config objects, and we always assume that is a dict. To correct this, raise the syntax error earlier in that case. Change-Id: Id7c1dff5e9865d21c3215bdc32c8fa2cb6603aaa
Diffstat (limited to 'zuul/change_matcher.py')
-rw-r--r--zuul/change_matcher.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/zuul/change_matcher.py b/zuul/change_matcher.py
index 139c7b6a9..0a347bc72 100644
--- a/zuul/change_matcher.py
+++ b/zuul/change_matcher.py
@@ -82,6 +82,17 @@ class BranchMatcher(AbstractChangeMatcher):
return True
return False
+ def serialize(self):
+ return {
+ "implied": self.exactmatch,
+ "regex": self._regex,
+ }
+
+ @classmethod
+ def deserialize(cls, data):
+ o = cls.__new__(cls, data['regex'])
+ return o
+
class ImpliedBranchMatcher(BranchMatcher):
exactmatch = True