mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-22 10:38:44 +02:00
Add test cases and docString for regex in COPY command (#2773)
This commit is contained in:
@@ -58,6 +58,7 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu
|
||||
return errors.Wrap(err, "getting user group from chown")
|
||||
}
|
||||
|
||||
// sources from the Copy command are resolved with wildcards {*?[}
|
||||
srcs, dest, err := util.ResolveEnvAndWildcards(c.cmd.SourcesAndDest, c.fileContext, replacementEnvs)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "resolving src")
|
||||
|
||||
@@ -51,6 +51,21 @@ var copyTests = []struct {
|
||||
sourcesAndDest: []string{"foo", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy f* into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"foo*", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy fo? into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"fo?", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy f[o][osp] into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"f[o][osp]", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
}
|
||||
|
||||
func setupTestTemp(t *testing.T) string {
|
||||
|
||||
Reference in New Issue
Block a user