--- title: "ADR 0035: Sorting code is copied from kubectl and the Tekton CLI" --- * Status: accepted * Code: [`pkg/sort/runtime_sort.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/sort/runtime_sort.go), [`pkg/sort/pipelinerun.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/sort/pipelinerun.go), [`pkg/sort/repository.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/sort/repository.go) ## Context `RuntimeSort` is taken from the `kubectl get` sorter (`staging/src/k8s.io/kubectl/pkg/cmd/get/sorter.go` of [`kubernetes/kubernetes@20d0ab7ae808aaddb1556c3c38ca0607663c50ac`](https://github.com/kubernetes/kubernetes/commit/20d0ab7ae808aaddb1556c3c38ca0607663c50ac)). `pipelinerun.go` and `repository.go` are taken from the Tekton CLI `prsort` package. ## Decision Only the needed parts are copied instead of importing kubectl or the Tekton CLI, to avoid pulling in all their dependencies. ## Consequences * These files follow upstream shape, not PAC conventions; the bare `//nolint` in `isLess` comes with the copy. * Fixes made upstream are not picked up automatically. * Sorting of equal start times in `pipelinerun.go` is by name descending.