Skip to content

Commit

Permalink
fix(apply): deep merge secrets and values
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Oct 21, 2024
1 parent 83e253d commit d34a665
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions riocli/apply/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import click
import yaml
from benedict import benedict
from graphlib import TopologicalSorter
from munch import munchify

Expand All @@ -28,7 +29,7 @@
print_resolved_objects,
)
from riocli.config import Configuration
from riocli.constants import Colors, Symbols, ApplyResult
from riocli.constants import ApplyResult, Colors, Symbols
from riocli.exceptions import ResourceNotFound
from riocli.utils import dump_all_yaml, print_centered_text, run_bash
from riocli.utils.graph import Graphviz
Expand Down Expand Up @@ -488,7 +489,7 @@ def _inject_rio_namespace(self, values: typing.Optional[dict] = None) -> dict:
}

if "rio" in values:
values["rio"].update(rio)
benedict(values["rio"]).merge(rio)
else:
values["rio"] = rio

Expand All @@ -498,15 +499,15 @@ def _process_values_and_secrets(
self, values: typing.List, secrets: typing.List
) -> None:
"""Process the values and secrets files and inject them into the manifest files"""
self.values, self.secrets = {}, {}
self.values, self.secrets = benedict({}), benedict({})

values = values or []
secrets = secrets or []

for v in values:
self.values.update(self._load_file_content(v, is_value=True)[0])
benedict(self.values).merge(self._load_file_content(v, is_value=True)[0])

self.values = self._inject_rio_namespace(self.values)

for s in secrets:
self.secrets.update(self._load_file_content(s, is_secret=True)[0])
benedict(self.values).merge(self._load_file_content(s, is_secret=True)[0])
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d34a665

Please sign in to comment.