Closed pmelange closed 4 years ago
root@buildbot:/etc# cat cron.hourly/buildbot-remove-old-builds
#!/bin/sh
BASE_DIR="/usr/local/src/www/htdocs/buildbot/unstable"
TARGETS=$(ls ${BASE_DIR})
for target in ${TARGETS}; do
for build in $(ls -t "${BASE_DIR}/${target}" | tail -n +10); do
rm -r "${BASE_DIR}/${target}/${build}"
done
done
#cd /usr/local/src/www/htdocs/buildbot/unstable/ar71xx && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ath79-generic && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ar71xx_mikrotik && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/x86 && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/mpc85xx && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ramips && rm -fr $(ls -t | tail -n +20)
#
#cd /usr/local/src/www/htdocs/buildbot/unstable/ar71xx-generic && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ar79-generic && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ar71xx-mikrotik && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/x86-generic && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/mpc85xx-generic && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ramips-mt7620 && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ramips-mt7621 && rm -fr $(ls -t | tail -n +20)
#cd /usr/local/src/www/htdocs/buildbot/unstable/ramips-mt76x8 && rm -fr $(ls -t | tail -n +20)
I tried integrating this into the buildbot configuration as build step in the past but failed. But I think this would be a far better solution than a cronjob.
I updated the installed cron.hourly script to this:
#!/bin/sh
BASE_DIR="/usr/local/src/www/htdocs/buildbot/unstable"
TARGETS=$(ls ${BASE_DIR})
for target in ${TARGETS}; do
for build in $(ls -t "${BASE_DIR}/${target}" | tail -n +10); do
rm -r "${BASE_DIR}/${target}/${build}"
done
done
In the past there was a cronjob to delete old devel builds.
https://github.com/freifunk-berlin/puppet-files/blob/master/files/buildbot-remove-old-builds.sh
But possibly it would be better as part of the master script, to run after a build is done.
https://github.com/freifunk-berlin/buildbot/blob/master/masters/master/master.cfg
If we decide to move it to the master script, then we should close this issue and open a new one in the buildbot repo.