fixed bug in copy
This commit is contained in:
parent
7dbc7a04a7
commit
cf713fe0cd
|
|
@ -2,7 +2,8 @@ FROM gcr.io/distroless/base:latest
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
FROM scratch as second
|
FROM scratch as second
|
||||||
COPY --from=0 context/foo /foo
|
ENV foopath context/foo
|
||||||
|
COPY --from=0 $foopath context/b* /foo/
|
||||||
|
|
||||||
FROM gcr.io/distroless/base:latest
|
FROM gcr.io/distroless/base:latest
|
||||||
COPY --from=second /foo /foo2
|
COPY --from=second /foo /foo2
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ func (c *CopyCommand) ExecuteCommand(config *manifest.Schema2Config) error {
|
||||||
}
|
}
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
if !filepath.IsAbs(dest) {
|
if !filepath.IsAbs(dest) {
|
||||||
dest = filepath.Join(cwd, dest)
|
// we need to add '/' to the end to indicate the destination is a directory
|
||||||
|
dest = filepath.Join(cwd, dest) + "/"
|
||||||
}
|
}
|
||||||
if err := util.CopyDir(fullPath, dest); err != nil {
|
if err := util.CopyDir(fullPath, dest); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func Parse(b []byte) ([]instructions.Stage, error) {
|
||||||
return stages, err
|
return stages, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolveStages resolves any calls to previous stages to the number value of that stage
|
// ResolveStages resolves any calls to previous stages with names to indices
|
||||||
// Ex. --from=second_stage should be --from=1 for easier processing later on
|
// Ex. --from=second_stage should be --from=1 for easier processing later on
|
||||||
func ResolveStages(stages []instructions.Stage) {
|
func ResolveStages(stages []instructions.Stage) {
|
||||||
nameToIndex := make(map[string]string)
|
nameToIndex := make(map[string]string)
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,9 @@ func RelativeFiles(fp string, root string) ([]string, error) {
|
||||||
fullPath := filepath.Join(root, fp)
|
fullPath := filepath.Join(root, fp)
|
||||||
logrus.Debugf("Getting files and contents at root %s", fullPath)
|
logrus.Debugf("Getting files and contents at root %s", fullPath)
|
||||||
err := filepath.Walk(fullPath, func(path string, info os.FileInfo, err error) error {
|
err := filepath.Walk(fullPath, func(path string, info os.FileInfo, err error) error {
|
||||||
|
if PathInWhitelist(path, root) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,8 @@ var tests = []struct {
|
||||||
expectedFiles: []string{
|
expectedFiles: []string{
|
||||||
"workspace/foo/a",
|
"workspace/foo/a",
|
||||||
"workspace/foo/b",
|
"workspace/foo/b",
|
||||||
"kaniko/file",
|
|
||||||
"workspace",
|
"workspace",
|
||||||
"workspace/foo",
|
"workspace/foo",
|
||||||
"kaniko",
|
|
||||||
".",
|
".",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue