Skip to content

Commit 38b0cb8

Browse files
committed
refactor: print stderr on kubectl error in message
1 parent f98dd2b commit 38b0cb8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pkg/devspace/deploy/deployer/kubectl/kubectl.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package kubectl
22

33
import (
4+
"bytes"
45
"context"
56
"fmt"
67
"io"
@@ -179,9 +180,11 @@ func (d *DeployConfig) Deploy(ctx devspacecontext.Context, _ bool) (bool, error)
179180
if shouldRedeploy || forceDeploy {
180181
args := d.getCmdArgs("apply", "--force")
181182
args = append(args, d.DeploymentConfig.Kubectl.ApplyArgs...)
182-
err = command.Command(ctx.Context(), ctx.WorkingDir(), writer, writer, strings.NewReader(replacedManifest), d.CmdPath, args...)
183+
184+
stdErrBuffer := &bytes.Buffer{}
185+
err = command.Command(ctx.Context(), ctx.WorkingDir(), writer, io.MultiWriter(writer, stdErrBuffer), strings.NewReader(replacedManifest), d.CmdPath, args...)
183186
if err != nil {
184-
return false, errors.Errorf("%v\nPlease make sure the command `kubectl apply` does work locally with manifest `%s`", err, manifest)
187+
return false, errors.Errorf("%v %v\nPlease make sure the command `kubectl apply` does work locally with manifest `%s`", stdErrBuffer.String(), err, manifest)
185188
}
186189

187190
wasDeployed = true

0 commit comments

Comments
 (0)