Skip to content

Commit

Permalink
Add func to append to ignorelist.
Browse files Browse the repository at this point in the history
This allows those using Kaniko as a library to add ignored dirs and
files without needs to modify /proc/self/mountinfo or doing other
strange things with mount -t tmpfs
  • Loading branch information
jkutner committed Aug 25, 2020
1 parent 0c71a1b commit 00c5ff8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/util/fs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func IgnoreList() []IgnoreListEntry {
return ignorelist
}

func AddToIgnoreList(entry IgnoreListEntry) {
ignorelist = append(ignorelist, entry)
}

func IncludeWhiteout() FSOpt {
return func(opts *FSConfig) {
opts.includeWhiteout = true
Expand Down
11 changes: 11 additions & 0 deletions pkg/util/fs_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ func Test_DetectFilesystemSkiplist(t *testing.T) {
testutil.CheckErrorAndDeepEqual(t, false, err, expectedSkiplist, actualSkiplist)
}

func Test_AddToIgnoreList(t *testing.T) {
AddToIgnoreList(IgnoreListEntry{
Path: "/tmp",
PrefixMatchOnly: false,
})

if ! CheckIgnoreList("/tmp") {
t.Errorf("CheckIgnoreList() = %v, want %v", false, true)
}
}

var tests = []struct {
files map[string]string
directory string
Expand Down

0 comments on commit 00c5ff8

Please sign in to comment.