Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/orchestrator/internal/template/build/commands/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/bmatcuk/doublestar/v4"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/e2b-dev/infra/packages/orchestrator/internal/proxy"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/sandboxtools"
Expand Down Expand Up @@ -67,7 +68,8 @@ elif [ -f "$entry" ]; then
elif [ -d "$entry" ]; then
# It's a directory – move all its contents into the destination folder
mkdir -p "$targetPath"
mv "$entry"/* "$targetPath/"
# Move all contents including hidden files
find "$entry" -mindepth 1 -maxdepth 1 -exec mv {} "$targetPath/" \;
else
echo "Error: entry is neither file nor directory"
exit 1
Expand All @@ -87,7 +89,7 @@ fi
// because the /tmp is mounted as a tmpfs and deleted on restart.
func (c *Copy) Execute(
ctx context.Context,
_ *zap.Logger,
logger *zap.Logger,
proxy *proxy.SandboxProxy,
sandboxID string,
_ string,
Expand Down Expand Up @@ -141,7 +143,8 @@ func (c *Copy) Execute(
return metadata.Context{}, fmt.Errorf("failed to copy layer tar data to sandbox: %w", err)
}

sbxUnpackPath := filepath.Join("/tmp", step.GetFilesHash())
// Create nested unpack directory to allow multiple files in the root be correctly detected
sbxUnpackPath := filepath.Join("/tmp", step.GetFilesHash(), "unpack")

// 3) Extract the tar file in the sandbox's /tmp directory
err = sandboxtools.RunCommand(
Expand Down Expand Up @@ -169,9 +172,12 @@ func (c *Copy) Execute(
return metadata.Context{}, fmt.Errorf("failed to execute copy script template: %w", err)
}

err = sandboxtools.RunCommand(
err = sandboxtools.RunCommandWithLogger(
ctx,
proxy,
logger,
zapcore.DebugLevel,
"unpack",
sandboxID,
moveScript.String(),
cmdMetadata,
Expand Down