---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cleanup-pipelineruns
spec:
  schedule: "1 4 * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          serviceAccount: cleaner
          volumes:
            - name: tkn-cleaner-script
              configMap:
                name: tkn-cleaner-script
                defaultMode: 493
          containers:
            - name: cleaner
              image: docker.io/scaps/ocp-k8s-tkn-basic-tools:latest
              env:
                - name: NAMESPACE
                  value: "my-tekton-build-project"
              command:
                - /opt/tkn-cleaner-script.sh
              volumeMounts:
                - name: tkn-cleaner-script
                  mountPath: /opt/
