Build Virtual Machines for Multiple Hypervisors with Jenkins and Packer
Building a virtual machine image for one target hypervisor probably doesn’t cut it anymore. If your organization is like most today, you run VMware in production, and you’re investigating AWS or OpenStack for burstability or a full blown migration, and your developers all run VirtualBox on their laptops. Except for Marvin. Marvin runs KVM because he’s a contributor to the project.
We can define cross-hypervisor machine definitions with Packer.
We can run Packer on a variety of machines to provide full hypervisor coverage with Jenkins.
Packer and Jenkins make a great team. They’re like peanut butter and chocolate. Or coffee and chocolate. Or pastry and chocolate.
/me grabs a chocolate bar from his drawer and gets back on track.
Many organizations use a single Jenkins server to run continuous integration builds, but Jenkins supports any number of slave nodes to distribute load. Further, we can assign labels to those nodes that define capabilities or other characteristics (host OS, installed software, special hardware architecture, etc).
Jobs can be pinned to nodes with specific labels, and the NodeLabel Parameter Plugin lets us use node labels as a parameter when building a job.
I give each of my build nodes a label of packer-${builder-name}, then I can build any machine in my Packer Open Source Appliances repository on all of my available local hypervisors and cloud accounts. My personal list includes qemu, docker, virtualbox-iso, and openstack (with Rackspace).
I’m pretty excited about this, and I’ll share more details and possible next steps in a future post. Until then, you can snag the job definition from my repository.