[Xfce4-commits] <xfce-buildbot-scripts:master> script to create new buildbot / buildslave combinations

Samuel Verstraete noreply at xfce.org
Thu Oct 22 16:26:02 CEST 2009


Updating branch refs/heads/master
         to 83db59a94d630b717507e4a2cc3c4d165e369777 (commit)
       from 6ac5df312579d54f134471ff17ac8ff613f1c8d7 (commit)

commit 83db59a94d630b717507e4a2cc3c4d165e369777
Author: Samuel Verstraete <samuel.verstraete at gmail.com>
Date:   Thu Oct 22 16:22:50 2009 +0200

    script to create new buildbot / buildslave combinations

 trunk/createNewBuildCluster.sh |  100 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 100 insertions(+), 0 deletions(-)

diff --git a/trunk/createNewBuildCluster.sh b/trunk/createNewBuildCluster.sh
new file mode 100644
index 0000000..3efd3ba
--- /dev/null
+++ b/trunk/createNewBuildCluster.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+declare -a SLAVEARRAY;
+
+function getUsedPortArray()  {
+  IFS=$'\n';
+  PORTARRAY=('8000')
+  COUNT=1;
+  for i in $(grep Port /etc/buildbot/XfceBuilder.py); do
+    PORTARRAY[$COUNT]=$(echo $i | cut -d":" -f2 | sed 's/,//g;s/[ \t]*$//g;s/[ \t]*//g');
+    ((COUNT++));
+  done
+}
+
+function getNextFreePort() {
+  getUsedPortArray;
+  LASTPORTNUMBER=$(echo ${PORTARRAY[@]} | tr " " "\n" | sort -n | tail -n 1)
+  NEWPORTNUMBER=$((LASTPORTNUMBER+1));
+  echo $NEWPORTNUMBER
+}
+
+function getSlaveArray() {
+  COUNT=0;
+  SLAVES=$(grep slaveList /etc/buildbot/XfceBuilder.py | sed s/slaveList\ =\ \\[\'//g |sed s/\'\\]//g | sed s/\'//g | tr "," " ")
+  for i in $SLAVES; do
+    SLAVEARRAY[$COUNT]=$i;
+    ((COUNT++));
+  done
+}
+
+function getPassword() {
+    PASSWORD=$(grep password /etc/buildbot/XfceBuilder.py | sed "s/[ ]t*$//g;s/[ \t]*//g;s/'//g;s/password=//g")
+}
+
+echo "Enter name of the module";
+read MODULE;
+
+echo "Enter name of the category";
+read CATEGORY;
+
+echo "Enter name of branch, <enter> for master";
+read BRANCH;
+if [ "$BRANCH" = "" ] ; then
+  BRANCH="defaults['branch']";
+else
+  BRANCH="'$BRANCH'"
+fi 
+
+echo "Enter period in minutes you want to trigger a rebuild, <enter> for 24h"
+read PERIOD;
+if [ "$PERIOD" = "" ] ; then
+  PERIOD="defaults['period']";
+else
+  PERIOD="'$PERIOD'"
+fi
+
+SLAVEPORT=$(getNextFreePort);
+WEBSTATUSPORT=$((SLAVEPORT+1));
+PBSTATUSPORT=$((WEBSTATUSPORT+1));
+
+
+cat >> /etc/buildbot/XfceBuilder.py <<ENDOFCONFIG
+${MODULE}Config = {
+  'name': '$MODULE',
+  'category': '$CATEGORY',
+  'branch': $BRANCH,
+  'period': $PERIOD,
+  'slavePort': $SLAVEPORT,
+  'webStatusPort': '$WEBSTATUSPORT',
+  'pbStatusPort': $PBSTATUSPORT
+}
+ENDOFCONFIG
+
+buildbot create-master $MODULE;
+
+sed s/xxx/$MODULE/ /etc/buildbot/template.cfg > /home/buildmaster/$MODULE/master.cfg
+
+buildbot checkconfig /home/buildmaster/$MODULE/master.cfg
+
+buildbot start /home/buildmaster/$MODULE
+
+getSlaveArray;
+getPassword;
+
+COUNT=0
+for SLAVE in ${SLAVEARRAY[@]}; do
+  echo "SLAVE "$COUNT " : " $SLAVE;
+  ((COUNT++));
+done
+
+for SLAVE in ${SLAVEARRAY[@]}; do
+  echo "******************************"
+  echo "CREATING BUILDSLAVE ON "$SLAVE
+  echo "******************************"
+  ssh $SLAVE buildbot create-slave /home/buildbot/$MODULE 10.0.0.2:$SLAVEPORT $SLAVE $PASSWORD;
+  ssh $SLAVE mkdir -p /home/buildbot/$MODULE/$CATEGORY/${SLAVE}_for_${MODULE}
+  ssh $SLAVE buildbot start /home/buildbot/$MODULE;
+done
+
+#echo ${SLAVEARRAY[@]};
+



More information about the Xfce4-commits mailing list