Skip to content

Filter ignore-paths recursively through bases - #6087

Open
akashchamp wants to merge 1 commit into
fluxcd:mainfrom
akashchamp:fix-ignore-paths-nested-bases
Open

akashchamp wants to merge 1 commit into
fluxcd:mainfrom
akashchamp:fix-ignore-paths-nested-bases

Conversation

@akashchamp

@akashchamp akashchamp commented Sep 24, 2026 •

Copy link
Copy Markdown

flux build --ignore-paths only filters the kustomization.yaml generated at the build root. Files matched by the patterns still leak into the build when they are reachable only through a referenced base or component (e.g. overlay -> ../base containing secret.enc.yaml).

This wraps the filesys.FileSystem passed to kustomize.Build (internal/build/ignorefs.go) so every kustomization file Kustomize reads has its resources, components and crds entries filtered against the ignore patterns, anchored to that file's own directory. It only reads through the filesystem abstraction and is only active when --ignore-paths is passed.

Closes #6067

Tests: new Test_ignoreFilterFS_filtersBaseResources in internal/build, plus CLI golden cases in cmd/flux (build ignore nested base, on-disk and --in-memory-build).

AI disclosure: this change was written with AI assistance (Claude Code / claude-sonnet-5), as recorded in the Assisted-by trailer of the commit.

fluxcd/pkg/kustomize only strips ignored entries from the
kustomization.yaml it generates at the build root. Native Kustomize
then reads any base or component straight off the filesystem, so a
file matched by --ignore-paths still leaks into the build whenever it
is only reachable through a referenced base or sub-directory.

Wrap the filesys.FileSystem handed to kustomize.Build so that every
kustomization file it reads, not just the root one, has its
resources, components and crds entries filtered the same way. The
ignore patterns are re-anchored to each file's own directory, so they
keep matching bases outside the build root (e.g. referenced with
../../base).

Signed-off-by: Akash Kumar <116457960+akashchamp@users.noreply.github.com>
Assisted-by: Claude Code/claude-sonnet-5
@akashchamp
akashchamp force-pushed the fix-ignore-paths-nested-bases branch from b0f3771 to 449fad0 Compare October 8, 2026 18:34

This branch has not been deployed

No deployments
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.

flux build --ignore-paths only filters root resources, leaking ignored files in bases and sub-directories

1 participant