Skip to content

Commit

Permalink
Avoid nil pointer when deleting buildrun
Browse files Browse the repository at this point in the history
Check case where there is no referenced taskrun pod.
  • Loading branch information
HeavyWombat committed Nov 27, 2020
1 parent e09a987 commit 7b0c1a6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/load/kubeops.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ func deleteBuildRun(kubeAccess KubeAccess, namespace string, name string, delete
return err
}

return wait.PollImmediate(1*time.Second, 10*time.Second, func() (done bool, err error) {
_, err = kubeAccess.Client.CoreV1().Pods(namespace).Get(pod.Name, metav1.GetOptions{})
return errors.IsNotFound(err), nil
})
if pod != nil {
err = wait.PollImmediate(1*time.Second, 10*time.Second, func() (done bool, err error) {
_, err = kubeAccess.Client.CoreV1().Pods(namespace).Get(pod.Name, metav1.GetOptions{})
return errors.IsNotFound(err), nil
})
}

return err
}

func waitForBuildRunCompletion(kubeAccess KubeAccess, buildRun *buildv1alpha1.BuildRun) (*buildv1alpha1.BuildRun, error) {
Expand Down

0 comments on commit 7b0c1a6

Please sign in to comment.