Skip to content

Commit

Permalink
Merge pull request #247 from eduolivares/log-dirname-alphabetical
Browse files Browse the repository at this point in the history
[Workflows] Order job name alphabetically
  • Loading branch information
openshift-merge-bot[bot] authored Nov 19, 2024
2 parents cd41d06 + 51044c9 commit 104d029
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
const (
workflowNameSuffix = "-workflow-counter"
jobNameStepInfix = "-workflow-step-"
logDirNameInfix = "-workflow-step-"
envVarsConfigMapinfix = "-env-vars-step-"
customDataConfigMapinfix = "-custom-data-step-"
workflowStepNumInvalid = -1
Expand Down Expand Up @@ -179,7 +178,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
Expand All @@ -190,7 +189,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 {
Expand All @@ -203,7 +202,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
Expand Down

0 comments on commit 104d029

Please sign in to comment.