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

Reliably detect evicted pods for failing BuildRuns #1390

Merged
merged 1 commit into from
Oct 5, 2023
Merged
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
12 changes: 8 additions & 4 deletions pkg/reconciler/buildrun/resources/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Clie
//nolint:staticcheck // SA1019 we want to give users some time to adopt to failureDetails
buildRun.Status.FailedAt = &buildv1alpha1.FailedAt{Pod: pod.Name}

if failedContainer != nil {
if pod.Status.Reason == "Evicted" {
message = pod.Status.Message
reason = buildv1alpha1.BuildRunStatePodEvicted
if failedContainer != nil {
//nolint:staticcheck // SA1019 we want to give users some time to adopt to failureDetails
buildRun.Status.FailedAt.Container = failedContainer.Name
}
} else if failedContainer != nil {
isibeni marked this conversation as resolved.
Show resolved Hide resolved
//nolint:staticcheck // SA1019 we want to give users some time to adopt to failureDetails
buildRun.Status.FailedAt.Container = failedContainer.Name
message = fmt.Sprintf("buildrun step %s failed in pod %s, for detailed information: kubectl --namespace %s logs %s --container=%s",
Expand All @@ -107,9 +114,6 @@ func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Clie
pod.Name,
failedContainer.Name,
)
} else if pod.Status.Reason == "Evicted" {
message = pod.Status.Message
reason = buildv1alpha1.BuildRunStatePodEvicted
} else {
message = fmt.Sprintf("buildrun failed due to an unexpected error in pod %s: for detailed information: kubectl --namespace %s logs %s --all-containers",
pod.Name,
Expand Down
Loading