Skip to content

Commit

Permalink
fix: reduce Init Process size from 35MB to 5MB
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Oct 28, 2024
1 parent 4fefdca commit 3b1cc3d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/testworkflow-init/commands/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ import (
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/output"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/action/actiontypes/lite"
constants2 "github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/constants"
"github.com/kubeshop/testkube/pkg/version"
)

// Moved from testworkflowprocessor/constants to reduce init process size
const (
defaultInitImageBusyboxBinaryPath = "/.tktw-bin"
)

func Setup(config lite.ActionSetup) error {
stdout := output.Std
stdoutUnsafe := stdout.Direct()
Expand Down Expand Up @@ -50,7 +54,7 @@ func Setup(config lite.ActionSetup) error {
if config.CopyBinaries {
// Use `cp` on the whole directory, as it has plenty of files, which lead to the same FS block.
// Copying individual files will lead to high FS usage
err := exec.Command("cp", "-rf", constants2.DefaultInitImageBusyboxBinaryPath, data.InternalBinPath).Run()
err := exec.Command("cp", "-rf", defaultInitImageBusyboxBinaryPath, data.InternalBinPath).Run()
if err != nil {
stdoutUnsafe.Error(" error\n")
stdoutUnsafe.Errorf(" failed to copy the binaries: %s\n", err.Error())
Expand Down

0 comments on commit 3b1cc3d

Please sign in to comment.