Uploaded image for project: 'OpenShift Pipelines'
  1. OpenShift Pipelines
  2. SRVKP-9431

Pruner error mechanism is not throwing errors when updating negative values in tektonconfig

XMLWordPrintable

      Description of problem:

      Pruner error mechanism is not throwing errors when updating negative values in tektonconfig 

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      1. Install 1.21 operator
      2. Update tektonpruner config with negative values in fields such as ttlSecondsAfterFinished in global-config & namespace level config
      tektonpruner:
          disabled: false
          global-config:
            enforcedConfigLevel: namespace
            failedHistoryLimit: null
            historyLimit: -100
            namespaces:
              dev1:
                PipelineRuns: null
                TaskRuns: null
                enforcedConfigLevel: null
                failedHistoryLimit: null
                historyLimit: null
                successfulHistoryLimit: 20
                ttlSecondsAfterFinished: -60
              test1:
                PipelineRuns: null
                TaskRuns: null
                enforcedConfigLevel: null
                failedHistoryLimit: null
                historyLimit: null
                successfulHistoryLimit: 5
                ttlSecondsAfterFinished: -300
            successfulHistoryLimit: 7
            ttlSecondsAfterFinished: -600
          options: {}
       

      Actual results:

      **

      tektonconfig is getting updated with negative values and the logs are being shown in tekton-controller pod instead of error mechanism

      {"severity":"ERROR","timestamp":"2025-11-26T10:09:20.509263983Z","logger":"tekton-pruner-controller","caller":"pipelinerun/reconciler.go:295","message":"Returned an error","knative.dev/pod":"tekton-pruner-controller-5b79589975-t5rqx","knative.dev/controller":"github.com.tektoncd.pruner.pkg.reconciler.pipelinerun.Reconciler","knative.dev/kind":"tekton.dev.PipelineRun","knative.dev/traceid":"a21e2eb6-6fa2-4dfe-aeaf-ca3c400e7a96","knative.dev/key":"test1/caches-python-pipeline-run-jpp57","targetMethod":"ReconcileKind","error":"failed to process TTL: TTL value -300 must be >= -1","stacktrace":"github.com/tektoncd/pipeline/pkg/client/injection/reconciler/pipeline/v1/pipelinerun.(*reconcilerImpl).Reconcile\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/github.com/tektoncd/pipeline/pkg/client/injection/reconciler/pipeline/v1/pipelinerun/reconciler.go:295\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/knative.dev/pkg/controller/controller.go:521\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/knative.dev/pkg/controller/controller.go:478"}
      {"severity":"ERROR","timestamp":"2025-11-26T10:09:20.509316025Z","logger":"tekton-pruner-controller","caller":"controller/controller.go:545","message":"Reconcile error","knative.dev/pod":"tekton-pruner-controller-5b79589975-t5rqx","knative.dev/controller":"github.com.tektoncd.pruner.pkg.reconciler.pipelinerun.Reconciler","knative.dev/kind":"tekton.dev.PipelineRun","knative.dev/traceid":"a21e2eb6-6fa2-4dfe-aeaf-ca3c400e7a96","knative.dev/key":"test1/caches-python-pipeline-run-jpp57","duration":"950.71µs","error":"failed to process TTL: TTL value -300 must be >= -1","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/knative.dev/pkg/controller/controller.go:545\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/knative.dev/pkg/controller/controller.go:522\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\t/go/src/github.com/openshift-pipelines/tektoncd-pruner/vendor/knative.dev/pkg/controller/controller.go:478"}
      {"severity":"INFO","timestamp":"2025-11-26T10:09:20.510479964Z","logger":"tekton-pruner-controller.event-broadcaster","caller":"record/event.go:377","message":"Event(v1.ObjectReference{Kind:\"PipelineRun\", Namespace:\"test1\", Name:\"caches-python-pipeline-run-jpp57\", UID:\"9b935c59-d570-4fb7-8c1f-f53c430d6ba4\", APIVersion:\"tekton.dev/v1\", ResourceVersion:\"869312\", FieldPath:\"\"}): type: 'Warning' reason: 'InternalError' failed to process TTL: TTL value -300 must be >= -1","knative.dev/pod":"tekton-pruner-controller-5b79589975-t5rqx"}
       

      Expected results:

      Pruner error mechanism should throw some error when editing the tektonconfig & negative values shouldn't be updated in tektonconfig{}
      Error loading pruner global config{error 26 0  error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go struct field PrunerConfig.SuccessfulHistoryLimit of type int32

       

      Reproducibility (Always/Intermittent/Only Once):

      Acceptance criteria: 

       

      Definition of Done:

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

       

       *

              rh-ee-anataraj Anitha Natarajan
              rh-ee-smanthin Sai Raju Manthina
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: