-
Type: Improvement
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Continuous Integration
-
Team:DevTools
Documentation and pointers are missing.
It seems that there are some bugs or improvements to fix:
A Jenkins job is missing, or the explanations why crontab is preferred.
The executed files are desynchronized from Git
The Git folder is not pulled before exec
Put the crontab itself under SCM (with reciprocal pointers) and others if missing (/root/clean-containers.py?).
chmod u+x /root/jenkins_workspace_cleanup.sh
Quick fix suggests: MAILTO, overwrite vs append to /var/log/jenkins_workspace_cleanup.log, log /root/clean-containers.py
MAILTO="" 0 0 * * * /root/jenkins_workspace_cleanup.sh > /var/log/jenkins_workspace_cleanup.log 2>&1 */30 * * * * find /opt/jenkins/workspace -path '*/*ws-cleanup*' -prune -mmin +60 -print -exec rm -fr -- {} \; >> /var/log/jenkins_workspace_cleanup.log 2>&1 0 0 * * * /root/clean-containers.py > /var/log/clean-containers.log 2>&1
The script may stop before end if there is no cleanup to perform:
### Remove Git repositories parent folders older than 2 days and bigger than 100M + xargs du -sh + find /opt/jenkins/workspace/ /opt/jenkins/workspace-priv/ -maxdepth 2 -type d -execdir test -d '{}/.git' ';' -mtime +2 -prune -print + sort -hr + grep -P '^(.*G|\d{3}M)\t' + cut '-d ' -f 2- + xargs rm -r -- rm: missing operand Try 'rm --help' for more information.
Review and document the logic of /root/clean-containers.py