Skip to content

Commit

Permalink
Add output option to helm-values command (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarojasm95 authored Jul 27, 2022
1 parent a448378 commit 8aaa88a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
17 changes: 15 additions & 2 deletions aladdin/commands/helm_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def parse_args(sub_parser):
dest="all_values",
action="store_true",
)
parser.add_argument(
"-o",
"--output",
help="output values to a file",
dest="output",
default=None,
)


@container_command
Expand All @@ -55,6 +62,7 @@ def helm_values(
git_ref: str = None,
chart: str = None,
all_values: bool = False,
output: str = None,
):
uri = urlparse(uri)
params = dict(parse_qsl(uri.query))
Expand Down Expand Up @@ -92,11 +100,16 @@ def helm_values(
)

logging.info("Executing: %s", " ".join(command))
subprocess.run(
result = subprocess.run(
command,
capture_output=False,
capture_output=output is not None,
check=True,
encoding="utf-8",
)
if output:
with open(output, "w") as outputfile:
outputfile.write(result.stdout)
logging.info("Values saved in: %s", output)


@contextmanager
Expand Down
3 changes: 2 additions & 1 deletion aladdin/commands/publish.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
import subprocess
import tempfile

Expand Down Expand Up @@ -124,7 +125,7 @@ def publish_clean(
f"Could not checkout to ref {ref} in repo {git_url}. Have you pushed it to remote?"
)
return
if init_submodules:
if init_submodules or os.path.exists(f"{tmpdirname}/.gitmodules"):
try:
g.init_submodules(tmpdirname)
except subprocess.CalledProcessError:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aladdin"
version = "1.19.7.29"
version = "1.19.7.30"
description = ""
authors = ["Fivestars <dev@fivestars.com>"]
include = [
Expand Down

0 comments on commit 8aaa88a

Please sign in to comment.