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

@ -258,6 +258,11 @@ class BuildTriggerHandler(object):
can be called in a loop, so it should be as fast as possible. """
pass
@classmethod
def path_is_dockerfile(cls, file_name):
""" Returns whether the file is named Dockerfile or follows the convention <name>.Dockerfile"""
return file_name.endswith(".Dockerfile") or u"Dockerfile" == file_name
@classmethod
def service_name(cls):
"""
@ -285,14 +290,7 @@ class BuildTriggerHandler(object):
def get_dockerfile_path(self):
""" Returns the normalized path to the Dockerfile found in the subdirectory
in the config. """
subdirectory = self.config.get('subdir', '')
if subdirectory == '/':
subdirectory = ''
else:
if not subdirectory.endswith('/'):
subdirectory = subdirectory + '/'
return subdirectory + 'Dockerfile'
return self.config.get('subdir', '')
def prepare_build(self, metadata, is_manual=False):
# Ensure that the metadata meets the scheme.