diff --git a/.circleci/config.yml b/.circleci/config.yml index f5b94bb..569165e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,6 +63,9 @@ jobs: fi done if [ "$MINUTES_PAST" -gt 120 ]; then + export IP_ADDRESS=$(cat /tmp/ip_address); + scp -i ~/.ssh/id_rsa root@"$IP_ADDRESS":/opt/DetectionLab/Vagrant/vagrant.log . + cat vagrant.log curl -X DELETE --header 'Accept: application/json' --header 'X-Auth-Token: '"$PACKET_API_TOKEN" 'https://api.packet.net/devices/'"$DEVICE_ID" exit 1 fi @@ -74,6 +77,9 @@ jobs: export STATUS=$(cat /tmp/status) echo $STATUS if [ "$STATUS" != "success" ]; then + export IP_ADDRESS=$(cat /tmp/ip_address); + scp -i ~/.ssh/id_rsa root@"$IP_ADDRESS":/opt/DetectionLab/Vagrant/vagrant.log . + cat vagrant.log curl -X DELETE --header 'Accept: application/json' --header 'X-Auth-Token: '"$PACKET_API_TOKEN" 'https://api.packet.net/devices/'"$DEVICE_ID" exit 1 fi diff --git a/ci/automated_install.sh b/ci/automated_install.sh index 3a3f447..dfd2111 100644 --- a/ci/automated_install.sh +++ b/ci/automated_install.sh @@ -24,8 +24,8 @@ ufw --force enable # Install Vagrant mkdir /opt/vagrant cd /opt/vagrant || exit 1 -wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb -dpkg -i vagrant_2.0.1_x86_64.deb +wget https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.deb +dpkg -i vagrant_2.0.2_x86_64.deb vagrant plugin install vagrant-reload # Install Packer @@ -51,4 +51,4 @@ cd /opt/DetectionLab || exit 1 # Start the build in a tmux session sn=tmuxsession tmux new-session -s "$sn" -d -tmux send-keys -t "$sn:0" './build.sh virtualbox && echo "success" > /var/www/html/index.html || echo "failed" > /var/www/html/index.html' Enter +tmux send-keys -t "$sn:0" './build.sh virtualbox | tee -a /opt/DetectionLab/Vagrant/vagrant.log && echo "success" > /var/www/html/index.html || echo "failed" > /var/www/html/index.html' Enter diff --git a/ci/automated_install_vagrant_only.sh b/ci/automated_install_vagrant_only.sh index 8569b79..463d559 100644 --- a/ci/automated_install_vagrant_only.sh +++ b/ci/automated_install_vagrant_only.sh @@ -24,8 +24,8 @@ ufw --force enable # Install Vagrant mkdir /opt/vagrant cd /opt/vagrant || exit 1 -wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb -dpkg -i vagrant_2.0.1_x86_64.deb +wget https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.deb +dpkg -i vagrant_2.0.2_x86_64.deb vagrant plugin install vagrant-reload # Make the Vagrant instances headless @@ -39,4 +39,4 @@ cd /opt/DetectionLab || exit 1 # Start the build in a tmux session sn=tmuxsession tmux new-session -s "$sn" -d -tmux send-keys -t "$sn:0" './build_vagrant_only.sh virtualbox && echo "success" > /var/www/html/index.html || echo "failed" > /var/www/html/index.html' Enter +tmux send-keys -t "$sn:0" './build_vagrant_only.sh virtualbox | tee -a /opt/DetectionLab/Vagrant/vagrant.log && echo "success" > /var/www/html/index.html || echo "failed" > /var/www/html/index.html' Enter