Cruise Control Overnight Builds

From Kb

Jump to: navigation, search

Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author


Cruise Control

  • Generates Build report on server

Adding a project to the automated cruise control build

  • Logon to Cruise Control Box
  • Checkout the project e.g.
cd ~home/builds/
svn co <svn-projectpath>
  • Edit the config.xml


Sample Config.xml

<cruisecontrol>
  <!-- Load environment variables -->
  <property environment="env" toupper="true"/>
  <property name="log.dir" value="logs/${project.name}"/>
  <property name="projects.dir" value="../builds"/>
  <property name="projects.checkout.dir" value="${projects.dir}"/>
  <property name="project.log.dir" value="${projects.dir}/logs/${project.name}"/>
  <property name="svn.repository" value="http://x.x.x.x:7777/svn/repository"/>
  <property name="svn.portal.project" value="${svn.repository}/portal/${project.name}"/>
  <property name="svn.user" value="svn-user-replace"/>
  <property name="svn.password" value="svn-password-replace"/>
  <property name="maven.home" value="/home/dev/maven/maven-2.0.4"/>
  <property name="schedule.interval" value="1000"/>
  <property name="quiet.period" value="120"/>
  <property name="buildresults.url" value="http://x.x.x.x:8080/buildresults/${project.name}"/>
  <property name="css.location" value="/home/dev/cruzctrl/cruisecontrol-bin-2.5/docs/cruisecontrol.css"/>
  <property name="xsl.dir" value="/home/dev/cruzctrl/cruisecontrol-bin-2.5/webapps/cruisecontrol/xsl"/>
  <property name="mail.host" value="your.mail.server"/>
  <property name="mail.address.buildmanager" value="your-email-1"/>
  <property name="mail.address.buildmanager" value="your-email-2"/>
  <property name="mail.subject.prefix" value="[Cruise Control] Project [${project.name}]"/>
 
  <project name="util" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
  <project name="ussd" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
  <project name="ussd-application" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install assembly:assembly"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
  <project name="o2services" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
  <project name="eserve" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="cruzctrl@o2.com" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
  <project name="alert" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
</cruisecontrol>


To add a project, add a new project element e.g.

<!-- Change the following to the project name in subversion-->
  <project name="your-project-name" buildafterfailed="false">
    <listeners>
	    <currentbuildstatuslistener file="${project.log.dir}/currentbuildstatus.txt"/>
    </listeners>
    <bootstrappers>
      <svnbootstrapper LocalWorkingCopy="${projects.checkout.dir}/${project.name}" username="${svn.user}" password="${svn.password}"/>
    </bootstrappers> 
    <modificationset quietperiod="${quiet.period}">
       <svn RepositoryLocation="${svn.portal.project}" username="${svn.user}" password="${svn.password}"/> 
    </modificationset>
    <schedule interval="${schedule.interval}">
	    <maven2 mvnhome="${maven.home}" pomfile="${projects.checkout.dir}/${project.name}/pom.xml" goal="clean install"/>
    </schedule>
    <log dir="${log.dir}">
	    <merge dir="${projects.checkout.dir}/${project.name}/**/TEST*.xml"/> 
    </log>
    <publishers>
      <htmlemail mailhost="${mail.host}"
	         subjectprefix="${mail.subject.prefix}"
		 returnaddress="return-email" 
		 buildresultsurl="${buildresults.url}"
		 css="${css.location}"
		 xsldir="${xsl.dir}"
		 xslfilelist="header.xsl,buildresults.xsl"
		 logdir="/home/dev/cruzctrl/cruisecontrol-bin-2.5/logs/${project.name}"
	      	 returnname="Cruise Control">
 
	 <failure address="${mail.address.portalonline}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager}" reportWhenFixed="true"/>
	 <failure address="${mail.address.buildmanager2}" reportWhenFixed="true"/>
      </htmlemail>
    </publishers>
  </project>
</source lang="xml">
Personal tools