<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Automated Build (CC.Net)</title>
        <link>http://geekswithblogs.net/jlt56789/category/4086.aspx</link>
        <description>Automated Build processes with CruiseControl.Net</description>
        <language>en-US</language>
        <copyright>Josh Tenenbaum</copyright>
        <managingEditor>josh-blog@sunset-solutions.net</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Build Process and DB sync</title>
            <link>http://geekswithblogs.net/jlt56789/archive/2006/02/26/70766.aspx</link>
            <description>&lt;P&gt;I've embraced CruiseControl.Net creating six build processes for our application.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A development build that runs 15 minutes after a commit 
&lt;LI&gt;A test build that runs on demand. 
&lt;LI&gt;A maint branch build that runs every 15 minutes. 
&lt;LI&gt;A maint branch test build that runs on demand. 
&lt;LI&gt;A rebuild of the test database that runs on demand. 
&lt;LI&gt;A rebuild of the maint database that runs on demand.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I've run through about 4 iterations setting up the process.&amp;nbsp; In two years, we finally came up with a stable process that with one exception hasn't messed up.&amp;nbsp; We've probably deployed about 100 - 150 times in those two years (that includes deployments to the client's staging/testing environment).&lt;/P&gt;
&lt;P&gt;The hardest part has been our database.&amp;nbsp; We copy down a copy of the latest version of our production database (its only about 1GB) everyday and archive that.&amp;nbsp; But, if the deployment is done after the backup, it was causing chaos for a reproducable testing environment.&amp;nbsp; We wanted to create the closest match we could to the production environment.&amp;nbsp; Especially since most of our bugs deal with strange cases, we also need to have an enviroment to reproduce without touching the client's data.&lt;/P&gt;
&lt;P&gt;In order to explain my database process, I need to explain how we number our builds.&amp;nbsp; Each build, increments the revision one.&amp;nbsp; So, if I commit a file, the automated build will update the build number from 3.4.0.3 to 3.4.0.4.&amp;nbsp; When we deploy, I update a &lt;A href="http://weblogs.asp.net/lorenh/archive/2004/09/20/232200.aspx"&gt;shared assembly info &lt;/A&gt;file and change it&amp;nbsp;to in this case 3.4.1.0.&amp;nbsp; The next build will then increment up.&amp;nbsp; Our database&amp;nbsp;patches are also named in this way, so we could have patch_3_4_0_0.sql and patch_3_4_0_1.sql.&amp;nbsp; The deployment&amp;nbsp;package (a zip file) could find these fine, but in interim states where, the build was incremented,&amp;nbsp;but the latest database backup had not been updated&amp;nbsp;problems arose, a manual process--prone to error--resulted in lots of headaches.&lt;/P&gt;
&lt;P&gt;My thought was to write an&amp;nbsp;NAnt&amp;nbsp;task to do this.&amp;nbsp; It was actually&amp;nbsp;amazing&amp;nbsp;easy.&amp;nbsp; I went for the easiest path, rather than efficient.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;go through and find every patch in the path passed in 
&lt;LI&gt;for each patch found, go through the db and see if it had been run* 
&lt;LI&gt;copy the patches to the dest location parameter.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;* As part of our patch, we write the patch version, date and time to&amp;nbsp;a table in the database.&lt;/P&gt;
&lt;P&gt;Its not my best work, not my worst.&amp;nbsp; Suggestions welcome.&amp;nbsp; If you want to look, &lt;A href="http://www.mindspring.com/~josh/profes/SQLPatch.zip"&gt;here is the source&lt;/A&gt;, feel free to use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=70766"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=70766" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/jlt56789/aggbug/70766.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Josh Tenenbaum</dc:creator>
            <guid>http://geekswithblogs.net/jlt56789/archive/2006/02/26/70766.aspx</guid>
            <pubDate>Mon, 27 Feb 2006 04:24:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/jlt56789/comments/70766.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/jlt56789/archive/2006/02/26/70766.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/jlt56789/comments/commentRss/70766.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/jlt56789/services/trackbacks/70766.aspx</trackback:ping>
        </item>
    </channel>
</rss>