@@ -54,17 +54,18 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu
5454
5555 uid , gid , err := getUserGroup (c .cmd .Chown , replacementEnvs )
5656 if err != nil {
57- return err
57+ return errors . Wrap ( err , "getting user group from chowm" )
5858 }
5959
6060 srcs , dest , err := util .ResolveEnvAndWildcards (c .cmd .SourcesAndDest , c .buildcontext , replacementEnvs )
6161 if err != nil {
62- return err
62+ return errors . Wrap ( err , "resolving src" )
6363 }
6464
6565 // For each source, iterate through and copy it over
6666 for _ , src := range srcs {
6767 fullPath := filepath .Join (c .buildcontext , src )
68+
6869 fi , err := os .Lstat (fullPath )
6970 if err != nil {
7071 return errors .Wrap (err , "could not copy source" )
@@ -79,27 +80,27 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu
7980
8081 destPath , err := util .DestinationFilepath (fullPath , dest , cwd )
8182 if err != nil {
82- return err
83+ return errors . Wrap ( err , "find destination path" )
8384 }
8485
8586 // If the destination dir is a symlink we need to resolve the path and use
8687 // that instead of the symlink path
8788 destPath , err = resolveIfSymlink (destPath )
8889 if err != nil {
89- return err
90+ return errors . Wrap ( err , "resolving dest symlink" )
9091 }
9192
9293 if fi .IsDir () {
9394 copiedFiles , err := util .CopyDir (fullPath , destPath , c .buildcontext , uid , gid )
9495 if err != nil {
95- return err
96+ return errors . Wrap ( err , "copying dir" )
9697 }
9798 c .snapshotFiles = append (c .snapshotFiles , copiedFiles ... )
9899 } else if util .IsSymlink (fi ) {
99100 // If file is a symlink, we want to copy the target file to destPath
100- exclude , err := util .CopySymlink (fullPath , destPath , c .buildcontext , uid , gid )
101+ exclude , err := util .CopySymlink (fullPath , destPath , c .buildcontext )
101102 if err != nil {
102- return err
103+ return errors . Wrap ( err , "copying symlink" )
103104 }
104105 if exclude {
105106 continue
@@ -109,7 +110,7 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu
109110 // ... Else, we want to copy over a file
110111 exclude , err := util .CopyFile (fullPath , destPath , c .buildcontext , uid , gid )
111112 if err != nil {
112- return err
113+ return errors . Wrap ( err , "copying file" )
113114 }
114115 if exclude {
115116 continue
0 commit comments