From df20fc028cb3a381df2648d8f616319ebbfaf644 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Wed, 1 Nov 2023 10:51:24 +1100 Subject: [PATCH] fix: use the lagoon task name for advanced tasks to allow cancellations to work properly --- internal/messenger/tasks_handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/messenger/tasks_handler.go b/internal/messenger/tasks_handler.go index c0937d44..ded60952 100644 --- a/internal/messenger/tasks_handler.go +++ b/internal/messenger/tasks_handler.go @@ -276,9 +276,13 @@ func (m *Messenger) createAdvancedTask(namespace string, jobSpec *lagoonv1beta1. func createAdvancedTask(namespace string, jobSpec *lagoonv1beta1.LagoonTaskSpec, m *Messenger, additionalLabels map[string]string) error { opLog := ctrl.Log.WithName("handlers").WithName("LagoonTasks") // create the advanced task + taskName := fmt.Sprintf("lagoon-advanced-task-%s", helpers.RandString(6)) + if jobSpec.Task.TaskName != "" { + taskName = jobSpec.Task.TaskName + } task := lagoonv1beta1.LagoonTask{ ObjectMeta: metav1.ObjectMeta{ - Name: "lagoon-advanced-task-" + helpers.RandString(6), + Name: taskName, Namespace: namespace, Labels: map[string]string{ "lagoon.sh/taskType": lagoonv1beta1.TaskTypeAdvanced.String(),