Showing posts with label continuous integration. Show all posts
Showing posts with label continuous integration. Show all posts

Monday, May 5, 2014

New developer? Start with the deliverables.

I have a developer new to the team who has an extensive system administration background. Due to various factors he has been working on our build processes rather than writing a lot of code initially. He mentioned that he enjoyed taking this approach because it was a "good bridge" to writing code.

That comment caused me to reflect on whether this might be a good introduction for all new developers. It seems like it, because the end product is what is important to our customers, not how elegant or innovative the underlying code is. Yes, of course, there is great value in well-written, high-performance code but that won't matter if the deliverable is defective to such a degree that the customer rejects it.

So how can one defend against distasteful defective releases? Configuration management is a set of practices that attempts to improve software quality. One of the important principles of configuration management is the concept of repeatable, reproducible builds. A continuous integration (CI) system gets you started down that path by eliminating the disruptive variables associated with the vagaries of what is installed on a developer's machine.

Setting up a build server as part of your CI system isn't a turnkey process however. One frequently needs to rewrite some code or reconfigure dependencies so that the application can be built in isolation on the build server, free from any detritus tied directly to a specific development machine. Once you get to that point you probably start realizing that you should have made some choices differently in the application. Essentially you're working from the outside in, and this viewpoint is really important. Think how much more efficiently the development team can work if projects are initiated with the goal of cleanly building on the build server rather than chasing down build issues specific to one person's development environment. The exercise of having new developers work within the configuration process earlier in their tenure rather than later resonates with me. Understanding the meta pieces that form the application is critical to deploying it, whether it is developers doing the deployment or a release engineering team.

I am more concerned about getting the release right than anything else. Having new developers- even seasoned developers, for that matter- understand the importance of writing code that fits easily into a CI environment is invaluable. For me, this holistic view of the code pays dividends in efficiency and quality.


Originally posted on LinkedIn.

Monday, March 12, 2012

remove web transform files

Today I am sharing the process that I used to remove web.config transforms after a build. I wish that I could claim that I was able to implement this in a knowledge vacuum, but I had some help. As you can see, all I am doing is creating a list of all files not named web.config and then deleting them.

  <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <ItemGroup>
      <DeleteAfterTransform Include="$(OutDir)_PublishedWebsites\$(TargetName)\Web.*.config" Exclude="$(OutDir)\_PublishedWebsites\$(TargetName)\Web.config" />
    </ItemGroup>
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
    <Message Text="WebProjectOutputDir: $(WebProjectOutputDir)" Importance="low" />
    <Message Text="OutDir: $(OutDir)" Importance="low" />
    <Message Text="TargetName: $(TargetName)" Importance="low" />
    <Message Text="ProjectConfigTransformFileName: $(ProjectConfigTransformFileName)" Importance="low" />
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(OutDir)\_PublishedWebsites\$(TargetName)\Web.config" />
    <Message Text="Preparing to remove config transform files." />
    <Message Text="Files: @(DeleteAfterTransform)" />
    <Delete Files="@(DeleteAfterTransform)">
      <Output TaskParameter="DeletedFiles" PropertyName="deleted" />
    </Delete>
    <Message Text="Deleted Files: $(deleted)" />
  </Target>
I hope that you find this post useful.

Tuesday, December 6, 2011

MvcBuildViews in a CI environment

This post isn't going to break any new ground in the world of computer science, but I still wanted to say a few words about the importance of using MvcBuildViews in your continuous integration environment.

My team had just finished a quick and slightly dirty ASP.NET MVC 3 project. The three of us rapidly created a very usable internal departmental financial application with two of the members of the team being ASP.NET MVC neophytes. A lot of learning occurred during development, both about the basics of HTTP and client scripting as well as Visual Studio's ASP.NET MVC 3 tooling.

I was finishing off numerous TODO's toward the end of the project when I entered "/p:MvcBuildViews=true" in the MSBuild arguments section of the Team Build process tab. The build crashed immediately due to nonexistent namespace issues. It seems that a family of CRUD Views had been created at some point that used a Model that no longer existed. Apparently the plan had been to go back and clean up dead code, but there was never any follow-up due to other priorities. The dead Views certainly weren't hurting anything. Also, a user could only access them if they somehow typed in the correct URL, a near impossible eventuality. However, I abhor dead code and extra files in a project. It not only distorts the size and complexity of a project but also increases the size of the deployment.

Using MvcBuildViews helped me remove four Views from our final deployment package. That's a trivial amount for large, enterprise projects. However, for a small department application likes ours, that's 20% of the Views. So not only are there now dramatically fewer Views to manage, the steepness of the learning curve for new developers is reduced.

Friday, May 28, 2010

Windows SDK 7.0A and automated builds

We altered our solution and project files to work with Visual Studio 2010. After changing the path to MSBuild.exe and altering ToolsVersion in the ccnet.config file to accommodate the framework change, CruiseControl.NET reported the following error:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1917,9):
errorMSB3086: Task could not find "LC.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A".
Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed

Various posts indicate that the 7.0A SDK ships with Visual Studio 2010. With that knowledge I copied the directory "Program Files\Microsoft SDKs\Windows\v7.0A" from my development machine to my build server. I then exported the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" registry key from my development machine and merged into the registry of the build server. Problem solved.