From 6b1470b704c9da3cca4642e351b367098da37991 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 1 Dec 2020 15:26:25 -0800 Subject: [PATCH] pkg/payload/task_graph: Require firstIncompleteNode to have tasks Our graph has some nodes without tasks, e.g. nodes which create a choke point between two sets of parallel nodes. Ideally we give all nodes descriptive names [1], but until we have that, require at least one entry in Tasks before we store a node as firstIncompleteNode. This avoids the chance of panicking during the subsequent [2]: fmt.Errorf("%d incomplete task nodes, beginning with %s", incompleteCount, firstIncompleteNode.Tasks[0]) [1]: https://github.com/openshift/cluster-version-operator/pull/435 [2]: https://bugzilla.redhat.com/show_bug.cgi?id=1903382 --- pkg/payload/task_graph.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/payload/task_graph.go b/pkg/payload/task_graph.go index d8d629e971..4ae4577484 100644 --- a/pkg/payload/task_graph.go +++ b/pkg/payload/task_graph.go @@ -536,7 +536,7 @@ func RunGraph(ctx context.Context, graph *TaskGraph, maxParallelism int, fn func incompleteCount := 0 for i, result := range results { if result == nil { - if firstIncompleteNode == nil { + if firstIncompleteNode == nil && len(graph.Nodes[i].Tasks) > 0 { firstIncompleteNode = graph.Nodes[i] } incompleteCount++