Skip to content

Commit

Permalink
fix(eks): reuse chart name as chart dir for helmchart deployment from…
Browse files Browse the repository at this point in the history
… OCI repository
  • Loading branch information
psemeniuk committed Jan 11, 2023
1 parent 0e552db commit db9dece
Show file tree
Hide file tree
Showing 41 changed files with 477 additions and 370 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def helm_handler(event, context):

if repository is not None and repository.startswith('oci://'):
tmpdir = tempfile.TemporaryDirectory()
chart_dir = get_chart_from_oci(tmpdir.name, release, repository, version)
chart_dir = get_chart_from_oci(tmpdir.name, repository, version)
chart = chart_dir

helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace)
Expand Down Expand Up @@ -123,7 +123,7 @@ def get_oci_cmd(repository, version):
return cmnd


def get_chart_from_oci(tmpdir, release, repository = None, version = None):
def get_chart_from_oci(tmpdir, repository = None, version = None):

cmnd = get_oci_cmd(repository, version)

Expand All @@ -135,7 +135,7 @@ def get_chart_from_oci(tmpdir, release, repository = None, version = None):
output = subprocess.check_output(cmnd, stderr=subprocess.STDOUT, cwd=tmpdir, shell=True)
logger.info(output)

return os.path.join(tmpdir, release)
return os.path.join(tmpdir, repository.rpartition('/')[-1])
except subprocess.CalledProcessError as exc:
output = exc.output
if b'Broken pipe' in output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def helm_handler(event, context):

if repository is not None and repository.startswith('oci://'):
tmpdir = tempfile.TemporaryDirectory()
chart_dir = get_chart_from_oci(tmpdir.name, release, repository, version)
chart_dir = get_chart_from_oci(tmpdir.name, repository, version)
chart = chart_dir

helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace)
Expand Down Expand Up @@ -123,7 +123,7 @@ def get_oci_cmd(repository, version):
return cmnd


def get_chart_from_oci(tmpdir, release, repository = None, version = None):
def get_chart_from_oci(tmpdir, repository = None, version = None):

cmnd = get_oci_cmd(repository, version)

Expand All @@ -135,7 +135,7 @@ def get_chart_from_oci(tmpdir, release, repository = None, version = None):
output = subprocess.check_output(cmnd, stderr=subprocess.STDOUT, cwd=tmpdir, shell=True)
logger.info(output)

return os.path.join(tmpdir, release)
return os.path.join(tmpdir, repository.rpartition('/')[-1])
except subprocess.CalledProcessError as exc:
output = exc.output
if b'Broken pipe' in output:
Expand Down
Binary file not shown.

This file was deleted.

Loading

0 comments on commit db9dece

Please sign in to comment.