Skip to content

Commit

Permalink
Merge pull request #421 from sm43/fix-cron
Browse files Browse the repository at this point in the history
  • Loading branch information
chmouel authored Feb 21, 2022
2 parents c708f33 + 312f03d commit 093c8c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/305-cleanup-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ spec:
- command:
- /bin/bash
- -c
- test -e /etc/config/max-keep-days && export MAX_DAY_KEEP=$(cat /etc/config/max-keep-days);for pr in $(kubectl get pipelineruns -l app.kubernetes.io/managed-by=pipelines-as-code -o json | python3 -c "import
- test -e /etc/config/max-keep-days && export MAX_DAY_KEEP=$(cat /etc/config/max-keep-days);for pr in $(kubectl get taskruns -l app.kubernetes.io/managed-by=pipelines-as-code -o json | python3 -c "import
os, sys, datetime, json;jeez=json.load(sys.stdin);res=[ i['metadata']['name']
for i in jeez['items'] if datetime.datetime.now() > datetime.datetime.strptime(i['metadata']['creationTimestamp'],
'%Y-%m-%dT%H:%M:%SZ') + datetime.timedelta(days=int(os.environ.get('MAX_DAY_KEEP', 1))) ];print(' '.join(res))");do
kubectl delete pipelinerun ${pr};done
kubectl delete taskrun ${pr};done
image: quay.io/openshift/origin-cli:4.8
imagePullPolicy: IfNotPresent
name: cleanup
Expand Down

0 comments on commit 093c8c7

Please sign in to comment.