SourceContext: add same_project comparison
The SourceContext equality check is using the in repository yaml path
which may differ for a single project, resulting in secrets being
incorrectly validated when they are defined in dedicated files.
This change adds a same_project method to validate secrets.
Change-Id: I5500e43faa3cbb7ed470575fe54cb66aed343b9a
diff --git a/zuul/model.py b/zuul/model.py
index 0e42368..4c5a51f 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -627,6 +627,13 @@
return self.__class__(self.project, self.branch, self.path,
self.trusted)
+ def isSameProject(self, other):
+ if not isinstance(other, SourceContext):
+ return False
+ return (self.project == other.project and
+ self.branch == other.branch and
+ self.trusted == other.trusted)
+
def __ne__(self, other):
return not self.__eq__(other)