Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow error from kind at image loading to propagate #4196

Merged
merged 1 commit into from
May 16, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pkg/skaffold/runner/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func (r *SkaffoldRunner) loadImagesInKindNodes(ctx context.Context, out io.Write
}

cmd := exec.CommandContext(ctx, "kind", "load", "docker-image", "--name", kindCluster, artifact.Tag)
if err := util.RunCmd(cmd); err != nil {
if output, err := util.RunCmdOut(cmd); err != nil {
color.Red.Fprintln(out, "Failed")
return fmt.Errorf("unable to load image with kind %q: %w", artifact.Tag, err)
return fmt.Errorf("unable to load image with kind %q: %w, %s", artifact.Tag, err, output)
}

color.Green.Fprintln(out, "Loaded")
Expand Down
10 changes: 5 additions & 5 deletions pkg/skaffold/runner/kind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestLoadImagesInKindNodes(t *testing.T) {
deployed: []build.Artifact{{Tag: "tag1"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
AndRun("kind load docker-image --name kind tag1"),
AndRunOut("kind load docker-image --name kind tag1", "output: image loaded"),
},
{
description: "load missing image",
Expand All @@ -55,7 +55,7 @@ func TestLoadImagesInKindNodes(t *testing.T) {
deployed: []build.Artifact{{Tag: "tag1"}, {Tag: "tag2"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "tag1").
AndRun("kind load docker-image --name other-kind tag2"),
AndRunOut("kind load docker-image --name other-kind tag2", "output: image loaded"),
},
{
description: "inspect error",
Expand All @@ -73,9 +73,9 @@ func TestLoadImagesInKindNodes(t *testing.T) {
deployed: []build.Artifact{{Tag: "tag"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
AndRunErr("kind load docker-image --name kind tag", errors.New("BUG")),
AndRunOutErr("kind load docker-image --name kind tag", "output: error!", errors.New("BUG")),
shouldErr: true,
expectedError: "unable to load",
expectedError: "output: error!",
},
{
description: "ignore image that's not built",
Expand All @@ -84,7 +84,7 @@ func TestLoadImagesInKindNodes(t *testing.T) {
deployed: []build.Artifact{{Tag: "built"}, {Tag: "busybox"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
AndRun("kind load docker-image --name kind built"),
AndRunOut("kind load docker-image --name kind built", ""),
},
{
description: "no artifact",
Expand Down