source-controller
source-controller copied to clipboard
Fix issue preventing `include`ed sources from being mapped to the repo root
This PR fixes https://github.com/fluxcd/source-controller/issues/1657. With this change, it should be possible to configure a GitRepository like so:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: example
spec:
# Omitting boilerplate for brevity
include:
- repository:
name: some-other-repo
fromPath: /some/other/repos/path
toPath: / # This line does not work without this patch
This approach is nice because Kustomizations using the example GitRepository can now set the path field to /some/subdirectory instead of /some/other/repos/path/some/subdirectory, making it easier to read. I've deployed this change and an example of its usage here. An image is available to test this here.