Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a virtual machine image as a continuous integration artifact?

I'm currently working on a server-side product which is a bit complex to deploy on a new server, which makes it an ideal candidate for testing out in a VM. We are already using Hudson as our CI system, and I would really like to be able to deploy a virtual machine image with the latest and greatest software as a build artifact.

So, how does one go about doing this exactly? What VM software is recommended for this purpose? How much scripting needs to be done to accomplish this? Are there any issues in particular when using Windows 2003 Server as the OS here?

like image 592
Nik Reiman Avatar asked Oct 06 '08 21:10

Nik Reiman


People also ask

How do I create a virtual machine image?

Search for and select Virtual machines. Select your VM from the list. In the Virtual machine page for the VM, on the upper menu, select Capture. The Create an image page appears.

How does a virtual machine image work?

A virtual machine is a computer file, typically called an image, that behaves like an actual computer. It can run in a window as a separate computing environment, often to run a different operating system—or even to function as the user's entire computer experience—as is common on many people's work computers.


3 Answers

Sorry to deny anyone an accepted answer here, but based on further research (thanks to your answers!), I've found a better solution and wanted to summarize what I've found.

First, both VirtualBox and VMWare Server are great products, and since both are free, each is worth evaluating. We've decided to go with VMWare Server, since it is a more established product and we can get support for it should we need. This is especially important since we are also considering distributing our software to clients as a VM instead of a special server installation, assuming that the overhead from the VMWare Player is not too high. Also, there is a VMWare scripting interface called VIX which one can use to directly install files to the VM without needing to install SSH or SFTP, which is a big advantage.

So our solution is basically as follows... first we create a "vanilla" VM image with OS, nothing else, and check it into the repository. Then, we write a script which acts as our installer, putting the artifacts created by Hudson on the VM. This script should have interfaces to copy files directly, over SFTP, and through VIX. This will allow us to continue distributing software directly on the target machine, or through a VM of our choice. This resulting image is then compressed and distributed as an artifact of the CI server.

like image 166
Nik Reiman Avatar answered Oct 21 '22 17:10

Nik Reiman


Regardless of the VM software (I can recommend VirtualBox, too) I think you are looking at the following scenario:

  1. Build is done
  2. CI launches virtual machine (or it is always running)
  3. CI uses scp/sftp to upload build into VM over the network
  4. CI uses the ssh (if available on target OS running in VM) or other remote command execution facility to trigger installation in the VM environment
like image 21
ADEpt Avatar answered Oct 21 '22 18:10

ADEpt


VMWare Server is free and a very stable product. It also gives you the ability to create snapshots of the VM slice and rollback to previous version of your virtual machine when needed. It will run fine on Win 2003.

In terms of provisioning new VM slices for your builds, you can simply copy and past the folder that contains the VMWare files, change the SID and IP of the new VM and you have a new machine. Takes 15 minutes depending on the size of your VM slice. No scripting required.

like image 34
David Robbins Avatar answered Oct 21 '22 18:10

David Robbins