Skip to content

Commit

Permalink
Adding dockerized test (vagrant_init_destroy_boxes)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Aug 30, 2018
1 parent 8b709f5 commit 985cb92
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
3 changes: 1 addition & 2 deletions build_all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash -eu

LOGFILE="/tmp/build_all.log"
#export USE_DOCKERIZED_PACKER="true"

(

Expand All @@ -12,6 +11,6 @@ LOGFILE="/tmp/build_all.log"
done
done

./vagrant_init_destroy_boxes.sh
./vagrant_init_destroy_boxes_docker.sh

) 2>&1 | tee $LOGFILE
2 changes: 1 addition & 1 deletion vagrant_init_destroy_boxes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vagrant_init_up() {
vagrant init $VAGRANT_BOX_NAME

# Disable VagrantBox GUI
if echo $VAGRANT_BOX_NAME | grep -q -i "virtualbox"; then
if [ "$VAGRANT_BOX_PROVIDER" = "virtualbox" ]; then
sed -i '/config.vm.box =/a \ \ config.vm.provider "virtualbox" do |v|\n \ \ \ v.gui = false\n\ \ end' $VAGRANT_CWD/Vagrantfile
fi

Expand Down
30 changes: 30 additions & 0 deletions vagrant_init_destroy_boxes_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash -eu

VAGRANT_INIT_DESTROY_BOXES_SCRIPT_PATH=$PWD

VAGRANT_BOX_FILE=$1

vagrant_box() {
docker run --rm -t -u $(id -u):$(id -g) --privileged --net=host \
-e HOME=/home/docker \
-e LOGFILE=/home/docker/vagrant/vagrant_init_destroy_boxes.log \
-v /dev/vboxdrv:/dev/vboxdrv \
-v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \
-v $VAGRANT_INIT_DESTROY_BOXES_SCRIPT_PATH:/home/docker/vagrant_script \
-v $VAGRANT_BOX_FILE_BASE_DIR:/home/docker/vagrant \
peru/vagrant_libvirt_virtualbox /home/docker/vagrant_script/vagrant_init_destroy_boxes.sh $VAGRANT_BOX_FILE_BASENAME
}



#######
# Main
#######

main() {
VAGRANT_BOX_FILE_BASE_DIR=$(dirname $VAGRANT_BOX_FILE)
VAGRANT_BOX_FILE_BASENAME=$(basename $VAGRANT_BOX_FILE)
vagrant_box
}

main

0 comments on commit 985cb92

Please sign in to comment.