feat(buildtrigger): allow use to specify dockerfile

users can only specify the folder and the
  dockerfile must be names "Dockerfile" this allows
  users to specify the file and it can be called
  "Dockerfile" or <some name>.Dockerfile
This commit is contained in:
Charlton Austin 2017-03-02 11:24:04 -05:00
parent aa2f88d321
commit e30cd931d1
12 changed files with 50 additions and 42 deletions

View file

@ -1,6 +1,7 @@
import logging
import os.path
import base64
import re
from calendar import timegm
from functools import wraps
@ -348,9 +349,8 @@ class GithubBuildTrigger(BuildTriggerHandler):
default_commit = repo.get_branch(branches[0]).commit
commit_tree = repo.get_git_tree(default_commit.sha, recursive=True)
return [os.path.dirname(elem.path) for elem in commit_tree.tree
if (elem.type == u'blob' and
os.path.basename(elem.path) == u'Dockerfile')]
return [elem.path for elem in commit_tree.tree
if (elem.type == u'blob' and self.path_is_dockerfile(os.path.basename(elem.path)))]
except GithubException as ghe:
message = ghe.data.get('message', 'Unable to list contents of repository: %s' % source)
if message == 'Branch not found':