fix: resolve fragment-relative file paths from fragment's own directory
What does this merge request do and why?
Fixes #180: Relative file paths declared inside a fragment (e.g. values_file, version_map, inline_file value_map entries, lifecycle hook script paths, repository directory) were previously resolved relative to the root caproni.yaml directory. This broke portability when fragments lived in subdirectories.
Changes
Core tracking mechanism:
- Add
SourceDir string \yaml:"-"`field toDeployerConfig,ReloaderConfig, andRepositoryConfig` — set to the fragment's directory after composition - Add
ResolvePathFrom(path, baseDir string)helper toCaproniConfigthat resolves relative tobaseDirwhen non-empty, falling back toConfigDir - Track fragment source directories in
resolveExtendsvia anelementSourcesmap; clear entries for elements overridden by the base config (base config always wins) - Apply
SourceDirto all config elements viaapplyElementSourcesafter loading
Call site updates — all path resolutions that use fragment-owned paths now use ResolvePathFrom(..., SourceDir):
internal/deployer/helm/manager.go—values_file,version_map,inline_filepathsinternal/deployer/helm/overrider.go—DynamicOverriderinterface updated to acceptdeployerConfiginternal/reloader/skaffold/manager.go— repository directoryinternal/executor/client.go—RunInRepositoryrepo directoryinternal/repository/git/manager.go— all git operationsinternal/update/updater.go— repository directorycmd/run/run.go,cmd/up/up.go,cmd/editmodeprocesssupervisor/editmodeprocesssupervisor.go
Tests: 7 new tests in internal/config/merge_test.go covering deployer/reloader/repository SourceDir assignment, subdirectory fragments, base-wins-over-fragment, and ResolvePathFrom edge cases (absolute path, relative with baseDir, relative without baseDir).
Docs & examples: Updated docs/config/composition.md with a "Relative paths in fragments" section; updated examples/extends/services/caproni.valkey.yaml to demonstrate values_file: ./valkey-values.yaml with a new valkey-values.yaml alongside the fragment.
References
Closes #180 Epic: gitlab-org#22297 (closed)
How to set up and validate locally
- Create a
caproni.yamlwith a fragment in a subdirectory:extends: - ./services/caproni.valkey.yaml - In
services/caproni.valkey.yaml, addvalues_file: ./valkey-values.yaml - Create
services/valkey-values.yaml - Run
caproni config print— the resolvedvalues_filepath should point toservices/valkey-values.yaml, notvalkey-values.yamlin the root