Skip to content

Commit 0ed83d9

Browse files
committed
include-dir-bins flag
Signed-off-by: Kyle Quest <kcq.public@gmail.com>
1 parent bdc4002 commit 0ed83d9

File tree

2 files changed

+44
-43
lines changed

2 files changed

+44
-43
lines changed

pkg/app/master/command/build/cli.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ var CLI = &cli.Command{
122122
cflag(FlagPreservePathFile),
123123
cflag(FlagIncludePath),
124124
cflag(FlagIncludePathFile),
125+
cflag(FlagIncludeDirBins),
125126
cflag(FlagIncludeBin),
126127
cflag(FlagIncludeBinFile),
127128
cflag(FlagIncludeExeFile),

pkg/app/sensor/artifact/artifact.go

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,60 +2278,60 @@ addExtraBinIncludes:
22782278
}
22792279

22802280
err := filepath.Walk(inPath,
2281-
func(pth string, info os.FileInfo, err error) error {
2282-
if strings.HasPrefix(pth, "/proc/") {
2283-
log.Debugf("skipping /proc file system objects... - '%s'", pth)
2284-
return filepath.SkipDir
2285-
}
2281+
func(pth string, info os.FileInfo, err error) error {
2282+
if strings.HasPrefix(pth, "/proc/") {
2283+
log.Debugf("skipping /proc file system objects... - '%s'", pth)
2284+
return filepath.SkipDir
2285+
}
22862286

2287-
if strings.HasPrefix(pth, "/sys/") {
2288-
log.Debugf("skipping /sys file system objects... - '%s'", pth)
2289-
return filepath.SkipDir
2290-
}
2287+
if strings.HasPrefix(pth, "/sys/") {
2288+
log.Debugf("skipping /sys file system objects... - '%s'", pth)
2289+
return filepath.SkipDir
2290+
}
22912291

2292-
if strings.HasPrefix(pth, "/dev/") {
2293-
log.Debugf("skipping /dev file system objects... - '%s'", pth)
2294-
return filepath.SkipDir
2295-
}
2292+
if strings.HasPrefix(pth, "/dev/") {
2293+
log.Debugf("skipping /dev file system objects... - '%s'", pth)
2294+
return filepath.SkipDir
2295+
}
22962296

2297-
// Optimization: Exclude folders early on to prevent slow enumerat
2298-
// Can help with mounting big folders from the host.
2299-
// TODO: Combine this logic with the similar logic in findSymlinks().
2300-
for _, xpattern := range excludePatterns {
2301-
if match, _ := doublestar.Match(xpattern, pth); match {
2302-
if info.Mode().IsDir() {
2303-
return filepath.SkipDir
2297+
// Optimization: Exclude folders early on to prevent slow enumerat
2298+
// Can help with mounting big folders from the host.
2299+
// TODO: Combine this logic with the similar logic in findSymlinks().
2300+
for _, xpattern := range excludePatterns {
2301+
if match, _ := doublestar.Match(xpattern, pth); match {
2302+
if info.Mode().IsDir() {
2303+
return filepath.SkipDir
2304+
}
2305+
return nil
23042306
}
2305-
return nil
23062307
}
2307-
}
23082308

2309-
if err != nil {
2310-
log.Debugf("skipping %s with error: %v", pth, err)
2311-
return nil
2312-
}
2309+
if err != nil {
2310+
log.Debugf("skipping %s with error: %v", pth, err)
2311+
return nil
2312+
}
23132313

2314-
if !info.Mode().IsRegular() {
2315-
return nil
2316-
}
2314+
if !info.Mode().IsRegular() {
2315+
return nil
2316+
}
23172317

2318-
pth, err = filepath.Abs(pth)
2319-
if err != nil {
2320-
return nil
2321-
}
2318+
pth, err = filepath.Abs(pth)
2319+
if err != nil {
2320+
return nil
2321+
}
23222322

2323-
if strings.HasPrefix(pth, "/proc/") ||
2324-
strings.HasPrefix(pth, "/sys/") ||
2325-
strings.HasPrefix(pth, "/dev/") {
2326-
return nil
2327-
}
2323+
if strings.HasPrefix(pth, "/proc/") ||
2324+
strings.HasPrefix(pth, "/sys/") ||
2325+
strings.HasPrefix(pth, "/dev/") {
2326+
return nil
2327+
}
23282328

2329-
if binProps, _ := binfile.Detected(pth); binProps != nil && binProps.IsBin {
2330-
binPathMap[pth] = struct{}{}
2331-
}
2329+
if binProps, _ := binfile.Detected(pth); binProps != nil && binProps.IsBin {
2330+
binPathMap[pth] = struct{}{}
2331+
}
23322332

2333-
return nil
2334-
})
2333+
return nil
2334+
})
23352335

23362336
if err != nil {
23372337
log.Errorf("saveArtifacts - error enumerating includeDirBinsList dir (%s) - %v", inPath, err)

0 commit comments

Comments
 (0)