freifunk-berlin / puppet

Deprecated: New infrastructure development is happening in https://github.com/freifunk-berlin/ansible
Other
2 stars 4 forks source link

buildbot.berlin: delete old devel builds #70

Closed pmelange closed 4 years ago

pmelange commented 4 years ago

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.

pmelange commented 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)
booo commented 4 years ago

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.

pmelange commented 4 years ago

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
nicolasberens commented 4 years ago

added the script in : https://github.com/freifunk-berlin/ff_base/commit/ee0f3cb847bf23bcad1e1fc8b0434b25ad9cb726