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, and RepositoryConfig` — set to the fragment's directory after composition
  • Add ResolvePathFrom(path, baseDir string) helper to CaproniConfig that resolves relative to baseDir when non-empty, falling back to ConfigDir
  • Track fragment source directories in resolveExtends via an elementSources map; clear entries for elements overridden by the base config (base config always wins)
  • Apply SourceDir to all config elements via applyElementSources after 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_file paths
  • internal/deployer/helm/overrider.go — DynamicOverrider interface updated to accept deployerConfig
  • internal/reloader/skaffold/manager.go — repository directory
  • internal/executor/client.go — RunInRepository repo directory
  • internal/repository/git/manager.go — all git operations
  • internal/update/updater.go — repository directory
  • cmd/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

  1. Create a caproni.yaml with a fragment in a subdirectory:
    extends:
      - ./services/caproni.valkey.yaml
  2. In services/caproni.valkey.yaml, add values_file: ./valkey-values.yaml
  3. Create services/valkey-values.yaml
  4. Run caproni config print — the resolved values_file path should point to services/valkey-values.yaml, not valkey-values.yaml in the root

Merge request reports

Loading
Loading