in k8s-bench/eval.go [282:304]
func (x *TaskExecution) runCleanup(ctx context.Context) error {
var errs []error
// Run cleanup if specified
if x.task.Cleanup != "" {
cleanupPath := filepath.Join(x.taskDir, x.task.Cleanup)
cmd := exec.CommandContext(ctx, cleanupPath)
cmd.Dir = x.taskDir
cmd.Env = append(os.Environ(), fmt.Sprintf("KUBECONFIG=%s", x.kubeConfig))
if err := x.runCommand(cmd); err != nil {
fmt.Printf("Warning: cleanup failed for task %s: %v\n", x.taskID, err)
}
}
for _, cleanup := range x.cleanupFunctions {
if err := cleanup(); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)
}