Skip to content

Commit b55379b

Browse files
committed
fix: Remove duplicate validator.Filter call and setRenderStatus function
- Remove duplicate validator.Filter() call in runValidators function - Remove duplicate setRenderStatus function (keeping setRenderConditionWithStatus) - Fix code duplication issues identified in code review Resolves code review comments on PR for issue #4450 Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
1 parent 26041d7 commit b55379b

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

internal/util/render/executor.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -319,32 +319,7 @@ func stepName(s kptfilev1.PipelineStepResult) string {
319319
return s.ExecPath
320320
}
321321

322-
// setRenderStatus reads the Kptfile at pkgPath, sets the Rendered condition and RenderStatus, and writes it back.
323-
func setRenderStatus(fs filesys.FileSystem, pkgPath string, condition kptfilev1.Condition, renderStatus *kptfilev1.RenderStatus) {
324-
fsOrDisk := filesys.FileSystemOrOnDisk{FileSystem: fs}
325-
kf, err := kptfileutil.ReadKptfile(fsOrDisk, pkgPath)
326-
if err != nil {
327-
klog.V(3).Infof("failed to read Kptfile for render status update at %s: %v", pkgPath, err)
328-
return
329-
}
330-
if kf.Status == nil {
331-
kf.Status = &kptfilev1.Status{}
332-
}
333-
// Replace any existing Rendered condition
334-
kf.Status.Conditions = slices.DeleteFunc(kf.Status.Conditions, func(c kptfilev1.Condition) bool {
335-
return c.Type == kptfilev1.ConditionTypeRendered
336-
})
337-
kf.Status.Conditions = append(kf.Status.Conditions, condition)
338322

339-
// Update render status if provided
340-
if renderStatus != nil {
341-
kf.Status.RenderStatus = renderStatus
342-
}
343-
344-
if err := kptfileutil.WriteKptfileToFS(fs, pkgPath, kf); err != nil {
345-
klog.V(3).Infof("failed to write render status to Kptfile at %s: %v", pkgPath, err)
346-
}
347-
}
348323

349324
// recordPipelineStepResult records the result of a pipeline step execution
350325
func recordPipelineStepResult(hctx *hydrationContext, stepResult kptfilev1.PipelineStepResult, isValidator bool) {
@@ -1114,10 +1089,6 @@ func (pn *pkgNode) runValidators(ctx context.Context, hctx *hydrationContext, in
11141089
stepResult.ExecutionError = err.Error()
11151090
stepResult.ExitCode = 1
11161091
recordPipelineStepResult(hctx, stepResult, true)
1117-
hctx.validationSteps = append(hctx.validationSteps, preExecFailureStep(function, err))
1118-
return err
1119-
}
1120-
if _, err = validator.Filter(cloneResources(selectedResources)); err != nil {
11211092
hctx.validationSteps = append(hctx.validationSteps, captureStepResult(function, hctx.fnResults, resultCountBeforeExec, err))
11221093
return err
11231094
}

0 commit comments

Comments
 (0)