Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions GitAutoDeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def getConfig(myClass):
return myClass.config

def do_POST(self):
urls = self.parseRequest()
for url in urls:
paths = self.getMatchingPaths(url)
url_refs = self.parseRequest()
for url, ref in url_refs:
paths = self.getMatchingPaths(url, ref)
for path in paths:
self.pull(path)
self.deploy(path)
Expand All @@ -47,14 +47,14 @@ def parseRequest(self):
items = []
for itemString in post['payload']:
item = json.loads(itemString)
items.append(item['repository']['url'])
items.append((item['repository']['url'], item['ref']))
return items

def getMatchingPaths(self, repoUrl):
def getMatchingPaths(self, repoUrl, ref):
res = []
config = self.getConfig()
for repository in config['repositories']:
if(repository['url'] == repoUrl):
if(repository['url'] == repoUrl and repository.get('ref', '') in ('', ref)):
res.append(repository['path'])
return res

Expand Down