Files
gitea-ci-library/gitea-reports/templates/retention-cronjob.yaml
T
moilanik baa5e8dac6
CI Feature / Load example-gitea-env.conf to pipeline env (push) Failing after 16s
CI Feature / Bats tests (push) Has been skipped
CI Feature / Cucumber tests (push) Has been skipped
CI Feature / Report Summary (push) Successful in 5s
git-pages siivottu pois, ja secret nimi nyt giteassa REPORTS_PUBLISH_TOKEN
2026-06-28 08:45:35 +03:00

73 lines
2.7 KiB
YAML

{{- if and .Values.persistence.enabled .Values.retention.enabled (eq .Values.retention.mode "cronjob") }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "gitea-reports.fullname" . }}-retention
labels:
{{- include "gitea-reports.componentLabels" . | nindent 4 }}
spec:
schedule: {{ .Values.retention.schedule | quote }}
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 3
jobTemplate:
spec:
backoffLimit: 1
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "gitea-reports.fullname" . }}-retention
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: {{ include "gitea-reports.fullname" . }}-retention
restartPolicy: OnFailure
containers:
- name: retention
image: "{{ .Values.retention.image.repository }}:{{ .Values.retention.image.tag }}"
imagePullPolicy: {{ .Values.retention.image.pullPolicy }}
securityContext:
runAsUser: 0
command:
- bash
- -c
- |
set -euo pipefail
apt-get update -qq
apt-get install -y --no-install-recommends curl jq >/dev/null
chmod +x /scripts/retention-run.sh
/scripts/retention-run.sh
env:
- name: DATA_ROOT
value: /app/data
- name: RETENTION_CONFIG
value: /etc/retention/retention.json
- name: GITEA_API_URL
value: {{ required "retention.giteaApiUrl is required" .Values.retention.giteaApiUrl | quote }}
- name: GITEA_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "gitea-reports.fullname" . }}-retention-gitea
key: token
volumeMounts:
- name: data
mountPath: /app/data
- name: scripts
mountPath: /scripts
- name: config
mountPath: /etc/retention
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "gitea-reports.fullname" . }}-data
- name: scripts
configMap:
name: {{ include "gitea-reports.fullname" . }}-retention
defaultMode: 0755
- name: config
configMap:
name: {{ include "gitea-reports.fullname" . }}-retention
items:
- key: retention.json
path: retention.json
{{- end }}