solver: specify SSH key ID in error message when required key was not forwarded

Signed-off-by: Tibor Vass <tibor@docker.com>
docker-18.09
Tibor Vass 2018-10-05 22:50:07 +00:00
parent 98e26e9685
commit c9b01072d0
2 changed files with 2 additions and 2 deletions

View File

@ -157,7 +157,7 @@ func testSSHMount(t *testing.T, sb integration.Sandbox) {
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil) _, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
require.Error(t, err) require.Error(t, err)
require.Contains(t, err.Error(), "no ssh forwarded from the client") require.Contains(t, err.Error(), "no SSH key ")
// custom ID not exposed // custom ID not exposed
st = llb.Image("busybox:latest").Run(llb.Shlex(`nosuchcmd`), llb.AddSSHSocket(llb.SSHID("customID"))) st = llb.Image("busybox:latest").Run(llb.Shlex(`nosuchcmd`), llb.AddSSHSocket(llb.SSHID("customID")))

View File

@ -302,7 +302,7 @@ func (e *execOp) getSSHMountable(ctx context.Context, m *pb.Mount) (cache.Mounta
return nil, nil return nil, nil
} }
if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented { if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented {
return nil, errors.Errorf("no ssh forwarded from the client") return nil, errors.Errorf("no SSH key %q forwarded from the client", m.SSHOpt.ID)
} }
return nil, err return nil, err
} }