Is it better to have a Build Server in a virtual machine? Do the benefits of having a build server in a VM outweigh the costs?
As always, it depends...
Assuming that you have other VM's running on the same server, and those other VM's can handle the occasional slowdowns caused by a running build, then I would say yes. But if you are going to host a single build server VM on a single host, or if the other VM's will be negatively impacted by the occasional build running, then no.
I can tell you that where I work, we have switched to hosting most of our build servers on VMWare. Since we run several builds a week of 5+ product lines it makes sense for us to host them all on one fast machine. We also host a large portion of our testing machines on the same server, which allows us to put the machine to good use, and since there are no production servers running on it, the slowdowns that occur during builds is not an issue.
I don't see any benefit, unless your VM is on some box which is a virtual server.
Here's some of the advantages of running your build server in a virtual environment:
Share one screaming fast box across several build servers - say you've got half a dozen build servers. Put together one very fast (4-cpu, 64-128gb ram, very fast hard drives, etc) machine and run a hypervisor on it. Now, all of the build servers can access this faster hardware if they're doing builds when other build servers aren't. Establish a build schedule, and you should be able to do faster builds. If you have to use physical boxes, you probably won't be able to afford that quality level of hardware on each individual build server - but that's easier to justify when it's shared.
No downtime when the box fails - instead of your production builds coming to a crashing halt whenever there's a hardware problem, you can simply boot up the build server on another virtualization host. (This only works well if you're using shared storage.)
Easy hardware upgrades - when it's time for a new build server, you don't have to do any pesky OS reinstalls. Just move the guest OS over to the new physical host, and you're off to the races.
A build server is something which needs to be built in a very consistent way. You need to have a well documented and thoroughly reproducible recipe for making your build server.
However, build-servers aren't massively performance-critical ... or at least, they're not critical to the performance of your production system, so you could have one in a VM.
Using VMs is actually quite a good idea if you need to be independent of hardware and software compatibility. Your preferred hardware vendor may stop supporting your required OS version for your build server in their new machines, then your warranty may expire on your old build server. This leaves you potentially unable to do builds in that OS.
You'd then be faced with either trawling ebay for a 2nd hand replacement, buying up your vendor's stock of obsolete kit, or doing some dodgy unsupported software hack. (NB: this almost happened to us, and we did a bit of some of these)
The pros and cons of using a VM for your build server are the same as using a VM for any other service.
This question is just as applicable to using a VM for a mail server / wiki server etc.
(I would have just posted this as a comment but don't have the rep yet)