Skip to content

Commit

Permalink
Refactor kapitan_compile() to work with Kapitan 0.34.4
Browse files Browse the repository at this point in the history
We need to refactor the call to `compile_targets()` to provide most
argument via the `cached.args` `Namespace` object, since
`compile_targets()` now takes a `Namespace` object instead of many
keyword args (cf. kapicorp/kapitan#1272).
  • Loading branch information
simu committed Jan 17, 2025
1 parent 0553b2a commit 5c8836c
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions commodore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,26 +269,31 @@ def kapitan_compile(
cached.args.multiline_string_style = "literal"
cached.args.yaml_dump_null_as_empty = False
cached.args.verbose = config.trace
cached.args.output_path = output_dir
cached.args.targets = targets
cached.args.parallelism = None
cached.args.labels = None
cached.args.prune = False
cached.args.indent = 2
cached.args.reveal = reveal
cached.args.cache = False
cached.args.cache_paths = None
cached.args.fetch = config.fetch_dependencies
# We always want to force-fetch when we want to fetch dependencies
# XXX(sg): We need to set `force` because otherwise `compile_targets()` raises an exception
# becaues the field is missing, but we can't set it to true, because otherwise
# `compile_targets()` emits a deprecation warning.
cached.args.force = False
cached.args.force_fetch = config.fetch_dependencies
cached.args.validate = False
cached.args.schemas_path = config.work_dir / "schemas"
cached.args.jinja2_filters = defaults.DEFAULT_JINJA2_FILTERS_PATH
cached.args.use_go_jsonnet = True
kapitan_targets.compile_targets(
inventory_path=cached.args.inventory_path,
search_paths=search_paths,
output_path=output_dir,
desired_targets=targets,
parallelism=None,
labels=None,
ref_controller=refController,
prune=False,
indent=2,
reveal=reveal,
cache=False,
cache_paths=None,
fetch=config.fetch_dependencies,
# We always want to force-fetch when we want to fetch dependencies
force_fetch=config.fetch_dependencies,
validate=False,
schemas_path=config.work_dir / "schemas",
jinja2_filters=defaults.DEFAULT_JINJA2_FILTERS_PATH,
use_go_jsonnet=True,
args=cached.args,
)


Expand Down

0 comments on commit 5c8836c

Please sign in to comment.