Skip to content

Commit 51044c9

Browse files
committed
[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.
1 parent 1f917b1 commit 51044c9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

controllers/common.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
const (
3232
workflowNameSuffix = "-workflow-counter"
3333
jobNameStepInfix = "-workflow-step-"
34-
logDirNameInfix = "-workflow-step-"
3534
envVarsConfigMapinfix = "-env-vars-step-"
3635
customDataConfigMapinfix = "-custom-data-step-"
3736
workflowStepNumInvalid = -1
@@ -178,7 +177,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin
178177
workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName
179178
}
180179

181-
return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum)
180+
return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName
182181
} else if typedInstance, ok := instance.(*v1beta1.Tempest); ok {
183182
if len(typedInstance.Spec.Workflow) == 0 || workflowStepNum == workflowStepNumInvalid {
184183
return typedInstance.Name
@@ -189,7 +188,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin
189188
workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName
190189
}
191190

192-
return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum)
191+
return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName
193192
} else if typedInstance, ok := instance.(*v1beta1.HorizonTest); ok {
194193
return typedInstance.Name
195194
} else if typedInstance, ok := instance.(*v1beta1.AnsibleTest); ok {
@@ -202,7 +201,7 @@ func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) strin
202201
workflowStepName = typedInstance.Spec.Workflow[workflowStepNum].StepName
203202
}
204203

205-
return typedInstance.Name + "-" + workflowStepName + jobNameStepInfix + strconv.Itoa(workflowStepNum)
204+
return typedInstance.Name + jobNameStepInfix + fmt.Sprintf("%02d", workflowStepNum) + "-" + workflowStepName
206205
}
207206

208207
return workflowStepNameInvalid

0 commit comments

Comments
 (0)