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

  1. Create caproni.yaml with extends: [./services/caproni.app.yaml] and a Helm deployer-free base.
  2. In services/caproni.app.yaml, declare a Helm deployer with values_file: ./values.yaml, and put values.yaml next to the fragment.
  3. Run caproni config print and confirm the deployer shows values_file: services/values.yaml.
  4. Override values_file: mine.yaml for that deployer in caproni.yaml and confirm the printed config shows mine.yaml, resolved from the config directory.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading