From 51044c945b8d4bc9bdf7dbf18a611a5bf5bb44ed Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Mon, 18 Nov 2024 13:27:35 +0100 Subject: [PATCH] [Workflows] Order job name alphabetically Usually directories are ordered alphabetically when we access to them via CLI or UI. With this change the alphabetical order corresponds with the workflow order. --- controllers/common.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/common.go b/controllers/common.go index 71991bb..6df0d4f 100644 --- a/controllers/common.go +++ b/controllers/common.go @@ -31,7 +31,6 @@ import ( const ( workflowNameSuffix = "-workflow-counter" jobNameStepInfix = "-workflow-step-" - logDirNameInfix = "-workflow-step-" envVarsConfigMapinfix = "-env-vars-step-" customDataConfigMapinfix = "-custom-data-step-" workflowStepNumInvalid = -1 @@ -178,7 +177,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName } - return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum) + return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName } else if typedInstance, ok := instance.(*v1beta1.Tempest); ok { if len(typedInstance.Spec.Workflow) == 0 || workflowStepNum == workflowStepNumInvalid { return typedInstance.Name @@ -189,7 +188,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName } - return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum) + return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName } else if typedInstance, ok := instance.(*v1beta1.HorizonTest); ok { return typedInstance.Name } else if typedInstance, ok := instance.(*v1beta1.AnsibleTest); ok { @@ -202,7 +201,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName } - return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum) + return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName } return workflowStepNameInvalid