# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: run-validation
spec:
  # runs every day at 4 a.m.
  schedule: "0 4 * * *"
  jobTemplate:
    spec:
      # https://docs.openshift.com/container-platform/3.11/dev_guide/jobs.html#jobs-setting-maximum-duration
      # set maximum duration to 4 hours
      activeDeadlineSeconds: 14400
      template:
        spec:
          volumes:
            - name: copr-config
              secret:
                secretName: copr-config
          containers:
            - name: run-validation
              image: quay.io/packit/packit-service-validation
              env:
                - name: GITHUB_TOKEN
                  valueFrom:
                    secretKeyRef:
                      name: github-token
                      key: token
                - name: SENTRY_SECRET
                  valueFrom:
                    secretKeyRef:
                      name: packit-sentry
                      key: sentry
              command: ["python3", "/usr/bin/packit-service-validation.py"]
              volumeMounts:
                - name: copr-config
                  mountPath: /.config
              resources:
                limits:
                  memory: "80Mi"
                  cpu: "100m"
          restartPolicy: OnFailure
