feat(config): resolve fragment file paths against the fragment's directory
What does this merge request do and why?
This MR makes file paths declared inside a config fragment resolve against the fragment's own
directory instead of the directory holding caproni.yaml.
A fragment is a partial caproni.yaml pulled in through extends:. Fragments can live in
subdirectories so they can ship their own supporting files, but until now a values_file: ./values.yaml
in services/caproni.valkey.yaml was looked up next to caproni.yaml, not next to the fragment.
A fragment therefore could not be moved together with its files, which is the point of putting it
in a subdirectory.
The loader now rebases the path fields of a subdirectory fragment onto the config directory on the
raw YAML, before the fragment is merged. Whichever layer wins a key already carries a path in the
right frame, so ResolvePath and its callers are untouched, and an override in caproni.yaml
keeps resolving against the config directory while an override of an unrelated key keeps the
fragment's path. Rebased fields are a Helm values_file, a version_map, the sources of an
inline_file override, a kustomize path, and the path of a file variable. Workspace locations
(repository directory, the repository of a gitlab_repo_version_files override, a skaffold
config_file) stay as they were. A fragment next to caproni.yaml is unchanged.
Remote fragments keep their existing per-reference handling; moving them onto the same rewrite is a follow-up.
References
- Closes #180
- Supersedes !489 (closed), which threaded a per-element source directory through every consumer
How to set up and validate locally
- Create
caproni.yamlwithextends: [./services/caproni.app.yaml]and a Helm deployer-free base. - In
services/caproni.app.yaml, declare a Helm deployer withvalues_file: ./values.yaml, and putvalues.yamlnext to the fragment. - Run
caproni config printand confirm the deployer showsvalues_file: services/values.yaml. - Override
values_file: mine.yamlfor that deployer incaproni.yamland confirm the printed config showsmine.yaml, resolved from the config directory.