Skip to content

Commit

Permalink
Periodically clear OpenRefine projects
Browse files Browse the repository at this point in the history
Fix #53
  • Loading branch information
ddeboer committed May 14, 2024
1 parent d8cc46c commit 5b843e8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions k8s/openrefine/cronjob.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: clear-openrefine-projects
spec:
schedule: "0 4 * * 6"
jobTemplate:
spec:
template:
spec:
containers:
- name: app
image: alpine:latest
imagePullPolicy: Always
command: ["bin/sh", "-c"]
env:
- name: ENDPOINT
value: "https://openrefine.netwerkdigitaalerfgoed.nl"
args:
- |
apk add --no-cache curl jq
csrf=$(curl -s "$ENDPOINT/command/core/get-csrf-token" | jq -r '.token')
projects=$(curl -s "$ENDPOINT/command/core/get-all-project-metadata" | jq '.projects | keys[] | tonumber')
for project in $projects; do
curl -s --data project="$project" --data csrf_token=$csrf "$ENDPOINT/command/core/delete-project"
done
restartPolicy: OnFailure

0 comments on commit 5b843e8

Please sign in to comment.