Skip to content

Commit 2cf6aa3

Browse files
author
NETIZEN-11
committed
fix: Address code review issues
- Remove duplicate setRenderStatus function in executor.go - Add TODO comment for unused opts parameter in pkgupdate.go - Fix path handling inconsistency in validation.go (use path.Clean instead of filepath.Clean) Resolves code review feedback from PR kptdev#4468 Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
1 parent f8a8606 commit 2cf6aa3

3 files changed

Lines changed: 4 additions & 28 deletions

File tree

internal/util/render/executor.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -319,33 +319,6 @@ 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)
338-
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-
}
348-
349322
// recordPipelineStepResult records the result of a pipeline step execution
350323
func recordPipelineStepResult(hctx *hydrationContext, stepResult kptfilev1.PipelineStepResult, isValidator bool) {
351324
if hctx.renderStatus == nil {

pkg/api/kptfile/v1/validation.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ func validateFnConfigPathSyntax(p string) error {
163163
if path.IsAbs(p) {
164164
return fmt.Errorf("path must be relative")
165165
}
166-
cleaned := filepath.Clean(p)
166+
// Use path.Clean instead of filepath.Clean for consistency with path.IsAbs
167+
// since Kptfile paths are always forward-slash separated.
168+
cleaned := path.Clean(p)
167169
if strings.Contains(cleaned, "..") {
168170
// fn config must not live outside the package directory
169171
// Allowing outside path opens up an attack vector that allows

pkg/lib/kptops/pkgupdate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
// PkgUpdateOpts are options for invoking kpt PkgUpdate.
4545
type PkgUpdateOpts struct {
4646
// Strategy defines the update strategy to use. Currently unused but reserved for future implementation.
47+
// TODO: Implement strategy-based updates (e.g., force-delete-replace, resource-merge, fast-forward)
4748
Strategy string
4849
}
4950

0 commit comments

Comments
 (0)