fix(buildcomponent): fix dockerfile cases
some errors were introduced with file paths of the form "/some_path/some_other_path" as "some_other_path" would be the dockerfile name
This commit is contained in:
parent
b05f235114
commit
afbd6fb19b
2 changed files with 32 additions and 9 deletions
|
@ -124,15 +124,7 @@ class BuildComponent(BaseComponent):
|
|||
# username: The username for pulling the base image (if any).
|
||||
# password: The password for pulling the base image (if any).
|
||||
|
||||
subdir, dockerfile_name = os.path.split(build_config.get('build_subdir', '/Dockerfile'))
|
||||
|
||||
# HACK HACK HACK HACK HACK HACK HACK
|
||||
# TODO: FIX THIS in the database and then turn the split back on.
|
||||
if dockerfile_name.find('Dockerfile') < 0:
|
||||
# This is a *HACK* for the broken path handling. To be fixed ASAP.
|
||||
subdir = build_config.get('build_subdir') or '/'
|
||||
dockerfile_name = 'Dockerfile'
|
||||
# /HACK HACK HACK HACK HACK HACK HACK
|
||||
subdir, dockerfile_name = self.name_and_path(build_config.get('build_subdir'))
|
||||
|
||||
build_arguments = {
|
||||
'build_package': build_job.get_build_package_url(self.user_files),
|
||||
|
@ -188,6 +180,14 @@ class BuildComponent(BaseComponent):
|
|||
old_commit_sha = build_config['trigger_metadata'].get('commit_sha', '')
|
||||
return commit_sha or old_commit_sha
|
||||
|
||||
@staticmethod
|
||||
def name_and_path(subdir):
|
||||
""" Returns the dockerfile path and name """
|
||||
if subdir.endswith("/"):
|
||||
subdir += "Dockerfile"
|
||||
elif not subdir.endswith("Dockerfile"):
|
||||
subdir += "/Dockerfile"
|
||||
return os.path.split(subdir)
|
||||
|
||||
@staticmethod
|
||||
def _total_completion(statuses, total_images):
|
||||
|
|
Reference in a new issue