Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7195 +/- ##
===========================================
+ Coverage 71.48% 81.56% +10.08%
===========================================
Files 694 896 +202
Lines 70971 91449 +20478
===========================================
+ Hits 50735 74594 +23859
- Misses 16577 16850 +273
+ Partials 3659 5 -3654 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jhrozek
left a comment
There was a problem hiding this comment.
Thanks for picking this up, the fix itself looks right to me. I merged it locally on top of current main and the wildcard matches go through the confinement checks added in #7196 as expected: patterns that escape the mount and symlinks pointing out of it are still skipped.
I'd like to see the test side changed before we merge, though.
This branch predates #6854, which gave every Processor its own artifact directory. So the processor.artifactDir = t.TempDir() override isn't needed anymore, and the comment about overlay artifacts being shared per process is no longer accurate.
Rather than a new standalone test, I'd prefer this covered as cases in TestGetOverlayMountsConfinedToMount, which came in with #7196. It already has the layout we need (ws/sub, alias -> sub, link pointing outside the mount), it's table-driven with require like the rest of the package, and it would also pin down how wildcard directory patterns interact with the confinement, which the current test can't do. After rebasing on main, something along these lines:
// next to the existing setup, a regular file whose name also matches s*
require.NoError(t, os.WriteFile(filepath.Join(ws, "subfile"), nil, 0o600))
{name: "wildcard directory pattern skips files", pattern: "s*/", expected: []string{"/app/sub"}},
{name: "wildcard directory pattern through a symlink inside the mount", pattern: "ali*/", expected: []string{"/app/sub"}},
{name: "wildcard directory pattern through a symlink leaving the mount", pattern: "lin*/", expected: nil},
{name: "wildcard directory pattern beyond the mount", pattern: "../out*/", expected: nil},I ran those four against the merged code and they give the results above. With them in place TestWildcardDirectoryPattern can be dropped.
getMatchingPaths only stat()ed a literal path for patterns ending in '/', so a wildcard directory pattern like 'secrets-*/' never matched and the directories it was meant to hide stayed visible in the container. Fall back to glob matching for directory patterns and keep only directory matches.
Address review feedback: rebase on main so the per-processor artifact directory from stacklok#6854 is used, extend TestGetOverlayMountsConfinedToMount with wildcard directory cases (file skip, symlink inside and outside the mount, pattern beyond the mount), and drop the standalone test.
b2ee15c to
98e9b99
Compare
|
Restructured per your suggestion — rebased on current main, dropped the |
|
Closing in favour of #7258 |
Summary
.thvignoredirectory patterns (a pattern ending in/) that contain wildcards never matched:getMatchingPathsonlyos.Stated the literal pattern path and returned early, sofilepath.Globwas never reached for directory patterns. Entries such assecrets-*/or*.egg-info/therefore produced no overlay and the directories stayed visible inside the container.TestWildcardDirectoryPatterncovering a multi-directory wildcard match, exclusion of a same-named file, and the overlays produced.Fixes #7182
Type of change
Test plan
go test ./pkg/ignore/(full package, repeated runs) passes, including the newTestWildcardDirectoryPatterntask test-e2e)gofmt -lclean andgo vet ./pkg/ignore/clean (task/golangci-lint unavailable in my environment)API Compatibility
No operator API surface changes.