The King of Automation

Every time I switch the CruiseControl builds over from one cvs branch to another, I have to do a fresh cvs checkout, specifying the new branch, on all the build slave boxes. This involves remoting into 12 machines and executing the following commands:

cd /D D:\
rd /s /q projects
mkdir d:\projects
cd /d d:\projects
cvs -d :extssh:login:password@machine:/data/cvsroot login
cvs -d :extssh:login@machine:/data/cvsroot co -r BRANCH project

I was pairing with Ivor, and about to do this manual process again, but Ivor said, “Do you want to try using psexec to automate this?”

Here’s what Ivor came up with initially:

update_slaves.cmd

set PODS=pod1 pod2 pod3 pod4 pod5 pod6 pod7 pod8 pod9 pod10 pod11 pod12
for %%p in (%PODS%) do start \\intware.com\iwd\iwd_apps\SysInternals\psexec.exe \\%%p -c checkout_branch.cmd

checkout_branch.cmd

cd /D D:\
rd /s /q projects
mkdir d:\projects
cd /d d:\projects
cvs -d :extssh:login:password@machine:/data/cvsroot login
cvs -d :extssh:login@machine:/data/cvsroot co -r BRANCH project

We encountered a problem with this initial solution–existing cvs and java processes prevented the deletion of directory ‘D:projects’. Ivor added a couple of calls to ‘taskkill’ to fix this. Here’s our final solution:

update_slaves.cmd

set PODS=pod1 pod2 pod3 pod4 pod5 pod6 pod7 pod8 pod9 pod10 pod11 pod12
for %%p in (%PODS%) do start \\intware.com\iwd\iwd_apps\SysInternals\psexec.exe \\%%p -c checkout_branch.cmd

checkout_branch.cmd

taskkill /f /im java.exe
taskkill /f /im cvs.exe
cd /D D:\
rd /s /q projects
mkdir d:\projects
cd /d d:\projects
cvs -d :extssh:login:password@machine:/data/cvsroot login
cvs -d :extssh:login@machine:/data/cvsroot co -r BRANCH project

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply