-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve error output when kompose fails #3299
Improve error output when kompose fails #3299
Conversation
Codecov Report
|
4b6d8a0
to
2441c36
Compare
+ Improve error when compose fails + Check if the compose-file exists + Add test Fix GoogleContainerTools#3288 Signed-off-by: David Gageot <david@gageot.net>
2441c36
to
d2ae2e8
Compare
// runKompose runs the `kompose` CLI before running skaffold init | ||
func runKompose(ctx context.Context, composeFile string) error { | ||
if _, err := os.Stat(composeFile); os.IsNotExist(err) { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does err
include the filename? Should this be wrapped with unable to find composeFile
? Or should we just continue down into kompose and let it show an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll show the filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll show the filename as is
@@ -74,7 +74,7 @@ func (*Commander) RunCmdOut(cmd *exec.Cmd) ([]byte, error) { | |||
|
|||
err = cmd.Wait() | |||
if err != nil { | |||
return stdout, errors.Wrapf(err, "Running %s: stdout %s, stderr: %s, err: %v", cmd.Args, stdout, stderr, err) | |||
return stdout, errors.Wrapf(err, "Running %s\n - stdout: %s\n - stderr: %s", cmd.Args, stdout, stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedding newlines doesn't seem great. It feels like this should be an object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do that. And it would have an Error() function that embeds newlines...
I'd rather keep this simple form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that object would have an Error() function with that string... I'd rather keep this simple form
util.RunCmdOut()
in case of error.Before:
After:
Signed-off-by: David Gageot david@gageot.net