[jbosstools-commits] JBoss Tools SVN: r43704 - trunk/build/util/cleanup.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 14 14:38:19 EDT 2012


Author: nickboldt
Date: 2012-09-14 14:38:19 -0400 (Fri, 14 Sep 2012)
New Revision: 43704

Added:
   trunk/build/util/cleanup/devstudio-product-cleanup.sh
Log:
https://issues.jboss.org/browse/JBIDE-8667 move scripts from devstudio/trunk/releng/org.jboss.ide.eclipse.releng/hudson/cleanup to jbosstools/trunk/build/util/cleanup

Added: trunk/build/util/cleanup/devstudio-product-cleanup.sh
===================================================================
--- trunk/build/util/cleanup/devstudio-product-cleanup.sh	                        (rev 0)
+++ trunk/build/util/cleanup/devstudio-product-cleanup.sh	2012-09-14 18:38:19 UTC (rev 43704)
@@ -0,0 +1,55 @@
+#!/bin/bash
+# This script is run here: http://hudson.qa.jboss.com/hudson/job/devstudio-cleanup/configure
+# And archived here: https://svn.jboss.org/repos/devstudio/trunk/releng/org.jboss.ide.eclipse.releng/hudson/devstudio-cleanup.sh
+# --------------------------------------------------------------------------------
+# clean JBDS builds from fish://dev01.qa.atl2.redhat.com:/qa/services/http/binaries/RHDS/{nightly,release}
+
+roots=$(find /qa/services/http/binaries/RHDS/builds/staging/ -maxdepth 2 -name builds | egrep "devstudio.*product")
+log=/tmp/${0##*/}.log.`date +%Y%m%d-%H%M`.txt
+
+echo "Logfile: $log" | tee -a $log
+echo "" | tee -a $log
+ 
+# before
+df -h $roots | tee -a $log
+echo "" | tee -a $log
+
+# Check for $type builds more than $threshhold days old; keep minimum $numkeep builds per branch
+clean () 
+{
+	type=$1 # nightly or release
+	numkeep=$2 # number of builds to keep per branch
+	threshhold=$3 # age at which a build is available for delete
+	echo "Check for $type builds more than $threshhold days old; keep minimum $numkeep builds per branch" | tee -a $log
+	for root in $roots; do
+	  for d in $(find $root/$type -maxdepth 1 -mindepth 1 -type d); do
+		echo "searching in $d"
+		newest=$(find $d -maxdepth 1 -mindepth 1 -type d -name "*" | sort -r | head -$numkeep) # keep these
+		echo "newest=$newest"
+		all=$(find $d -maxdepth 1 -mindepth 1 -type d -name "*" | sort -r) # only look to delete things more than $threshhold days old
+		echo "all=$all"
+		for dd in $all; do
+			keep=0;
+			for n in $newest; do
+				if [[ $dd == $n ]]; then
+					keep=1
+				fi
+			done
+			if [[ $keep -eq 0 ]]; then
+				echo "- $dd... " | tee -a $log
+				if [[ $USER == "hudson" ]]; then rm -fr $dd; fi
+			else
+				echo "+ $dd" | tee -a $log
+			fi
+		done
+	  done
+	done
+	echo "" | tee -a $log	
+}
+
+clean nightly 3 3
+
+# after
+df -h $roots | tee -a $log
+echo "" | tee -a $log
+


Property changes on: trunk/build/util/cleanup/devstudio-product-cleanup.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the jbosstools-commits mailing list