Skip to content

Commit

Permalink
refactor: rm bool param detectFilesystem in InitIgnoreList (#2843)
Browse files Browse the repository at this point in the history
  • Loading branch information
tal66 authored Nov 15, 2023
1 parent 11f0de8 commit 401616b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/executor/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func newStageBuilder(args *dockerfile.BuildArgs, opts *config.KanikoOptions, sta
return nil, err
}

err = util.InitIgnoreList(true)
err = util.InitIgnoreList()
if err != nil {
return nil, errors.Wrap(err, "failed to initialize ignore list")
}
Expand Down
10 changes: 4 additions & 6 deletions pkg/util/fs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func GetFSFromImage(root string, img v1.Image, extract ExtractFunction) ([]strin
func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, error) {
volumes = []string{}
cfg := new(FSConfig)
if err := InitIgnoreList(true); err != nil {
if err := InitIgnoreList(); err != nil {
return nil, errors.Wrap(err, "initializing filesystem ignore list")
}
logrus.Debugf("Ignore list: %v", ignorelist)
Expand Down Expand Up @@ -1032,14 +1032,12 @@ func createParentDirectory(path string) error {
// InitIgnoreList will initialize the ignore list using:
// - defaultIgnoreList
// - mounted paths via DetectFilesystemIgnoreList()
func InitIgnoreList(detectFilesystem bool) error {
func InitIgnoreList() error {
logrus.Trace("Initializing ignore list")
ignorelist = append([]IgnoreListEntry{}, defaultIgnoreList...)

if detectFilesystem {
if err := DetectFilesystemIgnoreList(config.MountInfoPath); err != nil {
return errors.Wrap(err, "checking filesystem mount paths for ignore list")
}
if err := DetectFilesystemIgnoreList(config.MountInfoPath); err != nil {
return errors.Wrap(err, "checking filesystem mount paths for ignore list")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/fs_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ func TestInitIgnoreList(t *testing.T) {
original := append([]IgnoreListEntry{}, ignorelist...)
defer func() { ignorelist = original }()

err = InitIgnoreList(true)
err = InitIgnoreList()
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 401616b

Please sign in to comment.