Skip to content

fix strategy: Merge for YAMLs in Glob sub-dirs - #383

Open
jonasbadstuebner wants to merge 1 commit into
fluxcd:mainfrom
jonasbadstuebner:dev/382
Open

jonasbadstuebner wants to merge 1 commit into
fluxcd:mainfrom
jonasbadstuebner:dev/382

Conversation

@jonasbadstuebner

Copy link
Copy Markdown

With this change, YAML files in sub-directories are merged as well.
Before only the YAML files in the root directory of the Glob pattern were merged, which made the test pass, but is not an intuitive behaviour.

fixes #382

@jonasbadstuebner

Copy link
Copy Markdown
Author

If you have any input on my changes, let me know and I'll try to address it. Maybe there are edge cases I didn't think about.

@jonasbadstuebner
jonasbadstuebner marked this pull request as draft September 18, 2026 22:52
@jonasbadstuebner
jonasbadstuebner marked this pull request as ready for review September 18, 2026 23:07
createFile(t, source2Dir, "config1.yaml", "env: prod") // This should overwrite the env
createFile(t, source2Dir, "config2.yaml", "replicas: 5") // This should add a new field in the root directory of the glob pattern
createFile(t, filepath.Join(source2Dir, "config"), "config3.yaml", "replicas: 10") // This should add a new field in a subdirectory matched by the glob pattern
createFile(t, filepath.Join(source2Dir, "config"), "config4.yaml", "content: hello-world") // This should add a new file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this test because the first iteration of my PR had a bug where if the target file would not exist, it would still have tried to merge the source file into it which lead to an error.
I think one more test case won't hurt.

Signed-off-by: Jonas Badstübner <jonas@jb.software>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] strategy: Merge does not work recursively on glob patterns

1 participant