Continuous Integration: PowerShell vs. CI Server (CC.NET or Hudson)

So, a friend and I have been discussing continuous integration and bat/powershell scripts versus CI servers like CruiseControl.Net or Hudson.

The following powershell pseudo script works to update from SVN, build using msbuild, deploy/copy out, update a build/revision number in the app, and emails on failed builds. The next step would be to add calls to MSTest and email results when not successful.

  1. svn update
  2. msbuild > build_deploy_development_out_msbuild
  3. ([xml](svn info --xml)).info.entry.commit.revision + [char]13 + [char]10 + (echo %date% %time%) > build_revision_number.html
  4. $linenumber = Select-String build_deploy_development_out_msbuild -pattern "Build Failed" | Select-Object Linenumber
  5. $smtp = New-Object System.Net.Mail.SMTPClient -ArgumentList localhost | if($linenumber > 0) $smtp.Send("From:Email","To:Email", "build failed", "build failed... some one must die!")

This has lead me to the question of the value of CI servers, when you can write your own shell scripts to accomplish the same goal, using the specific tools of the project (build tool, source control, unit testing) (i.e. msbuild, nant, svn, git, nunit, mstest, etc.)

I have not experienced the maintenance cost as of yet. I wanted to get others opinions on the roll your own shell script versus a CruiseControl.Net or Hudson. Please note, I do not have experience with CI servers, thus the question, so please don't take this as being critical of CI servers; I simply don't know the best answer, and thought I would ask the community.

Best wishes! Pete Gordon

This should be community wiki, as there is no clear answer
Michael Donohue 13.10.2009 19:09:35
Why is CC.NET or Hudson even listed? This seems like a Powershell VS CI question. Why the semantics?
TheOptimusPrimus 29.08.2013 18:34:50
5 ОТВЕТОВ

I've installed Hudson a couple of weeks ago to replace the current CruiseControl server. The greatest advantage I see in Hudson is that pretty much anybody can use it, while launching a parametrized build with CruiseControl (or a batch file) is still scary for a lot of people.

Usually I tend to write all my build scripts with Ant (because it's portable), insert a couple of parameters and I invoke them from Hudson.

Hudson gives your scripts a great visibility (everything can be seen on the front page) and they are self explanatory. Usually with a bash script, you need to write a readme (that nobody reads) and remember where they are located.

3
13.10.2009 18:05:44

... or have it both. Ayende (the creator of Rhino Mocks) has done that recently. He wrote a CI server using PowerShell. Perhaps this provides new insights for your discussion.

3
13.10.2009 18:24:22

CI Servers give you several advantages:

  • Web access, usually with ability to integrate with existing authentication mechanisms (see Hudson's ActiveDirectory/LDAP support)
  • Tons of existing support for unit testing, zip archive creationg, etc.
  • Hudson (and others) supports slave build nodes, for doing distributed CI tasks.
  • No need to maintain it yourself.

Some of these may not be things you need now but are you sure they aren't things you might need in the future?

9
13.10.2009 18:06:53
Would love to see a poll on peoples use of these types of features. I am not 100% confident I understand them all. It did make me curious about zip archiving in powershell, and I found this... tfl09.blogspot.com/2008/12/zip-files-with-powershell.html Thanks!
petegordon 14.10.2009 10:39:50
I've used some of these features and I've built a few adhoc Hudson plugins to solve some project specific needs. The most important aspect with Hudson is that it is a growing project with an increasing number of plugins.
Jim Rush 14.10.2009 12:48:29
How would you perform con-current builds with Powershell? How would you manage versioning, deployments and code coverage reporting? Why re-invent the wheel?
TheOptimusPrimus 29.08.2013 18:36:23

For a year I've tried to maintain custom-written python scripts to do basic CI stuff: recieving notifications of commits via e-mail, checking out and building stuff, sending back blames and congrats, then when it came to publishing this for use by everyone else in my team, it turned out raaaather unusable without monitoring, web-access, etc, etc.

Then I've dived into buildbot and found it truly beautiful. I've set up basically the same process in a couple of days. Build script is a true python object, that is customizeable at the master, from where it gets transferred to slaves and executed there. Built upon twisted framework, that is lots of stuff out-of-the-box ;)

Web UI is minimalistic, though sufficient.

Well, this is unpublished too, though I'm close to it this time %)

1
22.01.2010 15:33:05

Below are my thoughts on CI Server over a Powershell scripts

  • Highly Configurable Plugins are available for all different kinds of version control, notifications and testing.
  • Logs These are maintained wonderfully. Failure and succesful build logs are at your finger tip.
  • Scheduling You can set all kinds of scheduling including triggerring based on other succesful build
  • Security You can set different groups to be able to execute, view only or set to see some projects
  • Visibility You can use a web dashboard or cctray for different audiences.
  • Scalability. Easy to scale when needed.

Bottom line if you have to maintain lots of builds for different environment and team projects then CI Server is the way to go. Other than that a simple PowerShell Script is enough for small projects. Once the project grows you can just hook up the existing PowerShell Script to a CI Server.

1
29.08.2013 18:33:04