Merge "Add getProjectBranches to Source" into feature/zuulv3
This commit is contained in:
commit
86d2f726be
|
@ -551,7 +551,11 @@ class TenantParser(object):
|
|||
# Get in-project-repo config files which have a restricted
|
||||
# set of options.
|
||||
url = source.getGitUrl(project)
|
||||
# TODOv3(jeblair): config should be branch specific
|
||||
# TODOv3(jeblair): config should be branch specific. For
|
||||
# each branch in the repo, get the zuul.yaml for that
|
||||
# branch. Remember the branch and then implicitly add a
|
||||
# branch selector to each job there.
|
||||
source.getProjectBranches(project)
|
||||
job = merger.getFiles(project.name, url, 'master',
|
||||
files=['.zuul.yaml'])
|
||||
job.project = project
|
||||
|
|
|
@ -571,6 +571,12 @@ class GerritConnection(BaseConnection):
|
|||
(record.get('number'),))
|
||||
return changes
|
||||
|
||||
def getProjectBranches(self, project):
|
||||
refs = self.getInfoRefs(project)
|
||||
heads = [str(k[len('refs/heads/'):]) for k in refs.keys()
|
||||
if k.startswith('refs/heads/')]
|
||||
return heads
|
||||
|
||||
def addEvent(self, data):
|
||||
return self.event_queue.put((time.time(), data))
|
||||
|
||||
|
|
|
@ -63,3 +63,7 @@ class BaseSource(object):
|
|||
@abc.abstractmethod
|
||||
def getProject(self, name):
|
||||
"""Get a project."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def getProjectBranches(self, project):
|
||||
"""Get branches for a project"""
|
||||
|
|
|
@ -41,6 +41,9 @@ class GerritSource(BaseSource):
|
|||
def getProjectOpenChanges(self, project):
|
||||
return self.connection.getProjectOpenChanges(project)
|
||||
|
||||
def getProjectBranches(self, project):
|
||||
return self.connection.getProjectBranches(project)
|
||||
|
||||
def getGitUrl(self, project):
|
||||
return self.connection.getGitUrl(project)
|
||||
|
||||
|
|
Loading…
Reference in New Issue