summaryrefslogtreecommitdiff
path: root/zuul/driver/github/githubsource.py
diff options
context:
space:
mode:
authorJesse Keating <omgjlk@us.ibm.com>2017-01-30 17:10:44 -0800
committerJesse Keating <omgjlk@us.ibm.com>2017-05-23 21:47:49 -0700
commitae4cd274b1a194999cc7feabc8d0bff6ce0eb32b (patch)
tree056bb41ef8e43b03439715f408ae861e897a7bbf /zuul/driver/github/githubsource.py
parent8c6eeb5e8bf8201a3b3236613b54d67139242cf9 (diff)
downloadzuul-ae4cd274b1a194999cc7feabc8d0bff6ce0eb32b.tar.gz
Implement pipeline requirement on github reviews
Github reviews are a new pipeline requirement that is driver specific. Reviews can be approved, changes_requested, or comment. They can come from people with read, write, or admin access. Access is hierarchical, admin level includes write and read, and write access includes read. Review requirements model loosely the gerrit approvals, allowing filtering on username, email, newer-than, older-than, type, and permission. Brings in an unreleased Github3.py code. Further extends that code to determine if a user has push rights to a repository. Documentation is not included with this change, as the docs need restructuring for driver specific require / reject. Change-Id: I3ab2139c2b11b7dc8aa896a03047615bcf42adba Signed-off-by: Jesse Keating <omgjlk@us.ibm.com>
Diffstat (limited to 'zuul/driver/github/githubsource.py')
-rw-r--r--zuul/driver/github/githubsource.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/zuul/driver/github/githubsource.py b/zuul/driver/github/githubsource.py
index c0ae33f5d..ddb4aac11 100644
--- a/zuul/driver/github/githubsource.py
+++ b/zuul/driver/github/githubsource.py
@@ -14,6 +14,7 @@
import logging
import time
+import voluptuous as v
from zuul.source import BaseSource
from zuul.model import Project
@@ -96,6 +97,7 @@ class GithubSource(BaseSource):
def getRequireFilters(self, config):
f = GithubRefFilter(
statuses=to_list(config.get('status')),
+ required_reviews=to_list(config.get('review')),
)
return [f]
@@ -103,8 +105,18 @@ class GithubSource(BaseSource):
return []
+review = v.Schema({'username': str,
+ 'email': str,
+ 'older-than': str,
+ 'newer-than': str,
+ 'type': str,
+ 'permission': v.Any('read', 'write', 'admin'),
+ })
+
+
def getRequireSchema():
- require = {'status': scalar_or_list(str)}
+ require = {'status': scalar_or_list(str),
+ 'review': scalar_or_list(review)}
return require