diff --git a/cli/pkg/kctrl/cmd/app/release/release_cmd_runner.go b/cli/pkg/kctrl/cmd/app/release/release_cmd_runner.go index 6d5674dc8..0db52b5a0 100644 --- a/cli/pkg/kctrl/cmd/app/release/release_cmd_runner.go +++ b/cli/pkg/kctrl/cmd/app/release/release_cmd_runner.go @@ -35,9 +35,6 @@ func (r ReleaseCmdRunner) Run(cmd *goexec.Cmd) error { r.ui.PrintHeaderText("Building images and resolving references") } - if filepath.Base(cmd.Path) == "kapp" { - return nil - } if filepath.Base(cmd.Path) == "kbld" { cmd.Args = append(cmd.Args, fmt.Sprintf("--imgpkg-lock-output=%s", r.tempImgLockFilepath)) } @@ -57,6 +54,10 @@ func (r ReleaseCmdRunner) Run(cmd *goexec.Cmd) error { } func (r ReleaseCmdRunner) RunWithCancel(cmd *goexec.Cmd, cancelCh chan struct{}) error { + if filepath.Base(cmd.Path) == "kapp" { + return nil + } + if r.fullOutput { cmd.Stdout = io.MultiWriter(r.log, cmd.Stdout) cmd.Stderr = io.MultiWriter(r.log, cmd.Stderr) diff --git a/cli/pkg/kctrl/cmd/app/release/release_cmd_runner_test.go b/cli/pkg/kctrl/cmd/app/release/release_cmd_runner_test.go new file mode 100644 index 000000000..c29f62cdb --- /dev/null +++ b/cli/pkg/kctrl/cmd/app/release/release_cmd_runner_test.go @@ -0,0 +1,18 @@ +package release + +import ( + "bytes" + "os/exec" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestReleaseCmdRunnerForKappCmd(t *testing.T) { + var buf bytes.Buffer + ReleaseCmdRunner := NewReleaseCmdRunner(&buf, false, "", false, nil) + cmd := exec.Command("kapp", "deploy", "-f", "https://github.com/carvel-dev/kapp-controller/releases/latest/download/release.yml", "-a", "pkg-test", "-y") + err := ReleaseCmdRunner.RunWithCancel(cmd, nil) + require.NoError(t, err) + require.Emptyf(t, buf.Len(), "Expected buf length 0 but got %d", buf.Len()) +}