Created
November 12, 2012 17:46
-
-
Save tizzo/4060801 to your computer and use it in GitHub Desktop.
Jenkins Veewee Build Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION=`VBoxManage -v | sed 's/\(.*\)r\([0-9]*\)/\1/'` | |
if [ $RELEASE = "precise" ]; then | |
TEMPLATE="ubuntu-12.04.1-server-i386" | |
fi | |
if [ $RELEASE = "lucid" ]; then | |
TEMPLATE="ubuntu-10.04.4-server-i386" | |
fi | |
BOX_NAME="$RELEASE-vbox-$VERSION" | |
BOX_PATH="boxes/$RELEASE-vbox-$VERSION.box" | |
if [ `VBoxManage list runningvms | grep -c $BOX_NAME` -eq 1 ]; then | |
VBoxManage controlvm $BOX_NAME poweroff | |
fi | |
if [ `VBoxManage list vms | grep -c $BOX_NAME` -eq 1 ]; then | |
VBoxManage unregistervm $BOX_NAME --delete | |
fi | |
if [ `vagrant box list | grep -c $BOX_NAME` -eq 1 ]; then | |
vagrant box remove $BOX_NAME | |
fi | |
if [ -e $BOX_PATH ]; then | |
rm $BOX_PATH | |
fi | |
bundle install | |
bundle exec veewee vbox define $BOX_NAME $TEMPLATE | |
bundle exec veewee vbox build -n -a $BOX_NAME | |
VBoxManage controlvm $BOX_NAME poweroff | |
VBoxManage startvm $BOX_NAME -type headless | |
bundle exec veewee vbox validate $BOX_NAME | |
VBoxManage controlvm $BOX_NAME poweroff | |
vagrant package --base $BOX_NAME --output $BOX_PATH | |
vagrant box add $BOX_NAME $BOX_PATH | |
VBoxManage unregistervm $BOX_NAME --delete |
Added parameters to build lucid as well as precise.
Updated to allow multiple runs with the same release.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This job download the ubuntu server install iso (if necessary), downloads the guest additions ISO (if necessary), creates a VM and runs all install steps, runs the VeeWee vagrant behavior tests to verify the VM, exports the VM to a vagrant
.box
file, destroys the vm used for authoring the base box and then imports the exported box into vagrant for later provisioning.I wrote a blog post detailing this setup.
I run this as a an
Execute shell
step in a Jenkins build on my local mac with Jenkins running as my user and veewee checked out in the workspace for the job.