-
Notifications
You must be signed in to change notification settings - Fork 165
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
Returns error if build does not start successfully with kp create image --wait
#1309
Conversation
fmt.Fprintf(writer, "Build failed to start: %s", err) | ||
return "", nil |
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 should toss the error back up the chain instead of trying to handle it here
fmt.Fprintf(writer, "Build failed to start: %s", err) | |
return "", nil | |
return "", fmt.Errorf("build failed to start: %s", err) |
if err != nil { | ||
fmt.Fprintf(writer, "Build failed to start: %s", err) | ||
return "", nil | ||
} else { | ||
doneChan := make(chan struct{}) | ||
defer func() { <-doneChan }() | ||
|
||
go func() { // tail logs | ||
defer close(doneChan) | ||
err := w.logTailer.TailBuildName(ctx, writer, namespace, buildName) | ||
if err != nil { | ||
fmt.Fprintf(writer, "error tailing logs %s", 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.
|
||
condition := build.Status.GetCondition(corev1alpha1.ConditionSucceeded) | ||
if condition.IsFalse() { | ||
return errors.New(condition.Message) |
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.
return errors.New(condition.Message) | |
return buildFailure(condition.Message) |
kpack/pkg/logs/wait_for_image.go
Lines 137 to 144 in ca60665
func buildFailure(statusMessage string) error { | |
errMsg := "build failed" | |
if statusMessage != "" { | |
errMsg = fmt.Sprintf("%s: %s", errMsg, statusMessage) | |
} | |
return errors.New(errMsg) | |
} |
resolves buildpacks-community/kpack-cli#194