Add func to append to ignorelist.
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
This commit is contained in:
parent
146ec6a9cd
commit
0a0b4f1583
|
|
@ -90,6 +90,10 @@ func IgnoreList() []IgnoreListEntry {
|
||||||
return ignorelist
|
return ignorelist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AddToIgnoreList(entry IgnoreListEntry) {
|
||||||
|
ignorelist = append(ignorelist, entry)
|
||||||
|
}
|
||||||
|
|
||||||
func IncludeWhiteout() FSOpt {
|
func IncludeWhiteout() FSOpt {
|
||||||
return func(opts *FSConfig) {
|
return func(opts *FSConfig) {
|
||||||
opts.includeWhiteout = true
|
opts.includeWhiteout = true
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,17 @@ func Test_DetectFilesystemSkiplist(t *testing.T) {
|
||||||
testutil.CheckErrorAndDeepEqual(t, false, err, expectedSkiplist, actualSkiplist)
|
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 {
|
var tests = []struct {
|
||||||
files map[string]string
|
files map[string]string
|
||||||
directory string
|
directory string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue