refactor: use helper function to process uses steps
@@ -263,14 +263,22 @@ func processUsesSteps(resolver *UsesResolver, prs *tektonv1beta1.PipelineRun) er
}
for i := range tasksAndFinally {
pipelineTasks := tasksAndFinally[i]
- for j := range pipelineTasks {
- pt := &pipelineTasks[j]
+ if err := processUsesStepsHelper(resolver, prs, pipelineTasks); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func processUsesStepsHelper(resolver *UsesResolver, prs *tektonv1beta1.PipelineRun, pipelineTasks []tektonv1beta1.PipelineTask) error {
+ for i := range pipelineTasks {
+ pt := &pipelineTasks[i]
if pt.TaskSpec != nil {
ts := &pt.TaskSpec.TaskSpec
clearStepTemplateImage := false
var steps []tektonv1beta1.Step
- for k := range ts.Steps {
- step := ts.Steps[k]
+ for j := range ts.Steps {
+ step := ts.Steps[j]
image := step.Image
if image == "" && ts.StepTemplate != nil {
// lets default to the step image so we can share uses across steps
@@ -304,8 +312,6 @@ func processUsesSteps(resolver *UsesResolver, prs *tektonv1beta1.PipelineRun) er
}
}
}
- }
-
return nil
}
