refactor: rm bool param detectFilesystem in `InitIgnoreList` (#2843)

This commit is contained in:
tal66 2023-11-15 01:10:44 +00:00 committed by GitHub
parent 11f0de81f5
commit 401616bb38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -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")
}

View File

@ -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)
@ -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

View File

@ -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)
}