Skip to content

Instantly share code, notes, and snippets.

@tizzo
Created November 12, 2012 17:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tizzo/4060801 to your computer and use it in GitHub Desktop.
Save tizzo/4060801 to your computer and use it in GitHub Desktop.
Jenkins Veewee Build Script
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
@tizzo
Copy link
Author

tizzo commented Dec 6, 2012

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