diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dce45b4cb..b9f64f1d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,18 +26,18 @@ jobs: fail-fast: false matrix: stage: - - windows-server-2012_r2-standard-x64-eval-libvirt - - windows-server-2016-standard-x64-eval-libvirt - - windows-server-2019-standard-x64-eval-libvirt - my_centos-7-x86_64-libvirt - my_ubuntu-20.04-server-amd64-libvirt - my_windows-10-enterprise-x64-eval-libvirt - - windows-10-enterprise-x64-eval-libvirt - - ubuntu-20.04-server-amd64-libvirt - - ubuntu-18.04-server-amd64-libvirt - ubuntu-16.04-server-amd64-libvirt - - ubuntu-20.04-desktop-amd64-libvirt - ubuntu-18.04-desktop-amd64-libvirt + - ubuntu-18.04-server-amd64-libvirt + - ubuntu-20.04-desktop-amd64-libvirt + - ubuntu-20.04-server-amd64-libvirt + - windows-10-enterprise-x64-eval-libvirt + - windows-server-2012_r2-standard-x64-eval-libvirt + - windows-server-2016-standard-x64-eval-libvirt + - windows-server-2019-standard-x64-eval-libvirt steps: - name: Skip image build if it already exists in Vagrant Cloud @@ -113,18 +113,18 @@ jobs: fail-fast: false matrix: stage: - - windows-server-2012_r2-standard-x64-eval-virtualbox - - windows-server-2016-standard-x64-eval-virtualbox - - windows-server-2019-standard-x64-eval-virtualbox - my_centos-7-x86_64-virtualbox - my_ubuntu-20.04-server-amd64-virtualbox - my_windows-10-enterprise-x64-eval-virtualbox - - windows-10-enterprise-x64-eval-virtualbox - - ubuntu-20.04-server-amd64-virtualbox - - ubuntu-18.04-server-amd64-virtualbox - ubuntu-16.04-server-amd64-virtualbox - - ubuntu-20.04-desktop-amd64-virtualbox - ubuntu-18.04-desktop-amd64-virtualbox + - ubuntu-18.04-server-amd64-virtualbox + - ubuntu-20.04-desktop-amd64-virtualbox + - ubuntu-20.04-server-amd64-virtualbox + - windows-10-enterprise-x64-eval-virtualbox + - windows-server-2012_r2-standard-x64-eval-virtualbox + - windows-server-2016-standard-x64-eval-virtualbox + - windows-server-2019-standard-x64-eval-virtualbox steps: - name: Skip image build if it already exists in Vagrant Cloud diff --git a/tools/cleanup_all_vms.sh b/tools/cleanup_all_vms.sh index 3be43276e..ff1ae97db 100755 --- a/tools/cleanup_all_vms.sh +++ b/tools/cleanup_all_vms.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -LOGDIR=${LOGDIR:-/var/tmp/packer-templates-logs} PACKER_CACHE_DIR=${PACKER_CACHE_DIR:-/var/tmp/packer_cache} PACKER_IMAGES_OUTPUT_DIR=${PACKER_IMAGES_OUTPUT_DIR:-/var/tmp/packer-templates-images} +LOGDIR=${LOGDIR:-${PACKER_IMAGES_OUTPUT_DIR}} TMPDIR=${TMPDIR:-/tmp} set -euo pipefail @@ -24,6 +24,8 @@ if [[ -d "${TMPDIR}" ]]; then done < <(find "${TMPDIR}" -maxdepth 2 ! -readable -prune -o -type f -name Vagrantfile -printf "%h\0") fi +echo "*** Remove logs created by vagrant_init_destroy_boxes.sh form \"${LOGDIR}\"" +find "${LOGDIR}" -maxdepth 1 -mindepth 1 -name "*-init.log" -delete echo "*** Remove all PACKER_CACHE_DIR mess (not the iso files)" find "${PACKER_CACHE_DIR}" -mindepth 1 ! \( -type f -name "*.iso" \) -user "${USER}" -delete -print @@ -35,7 +37,6 @@ while IFS= read -r BOX; do vagrant box remove --force --all "${BOX}" done < <(vagrant box list | awk '{ print $1 }') - echo "*** Remove all VirtualBox instances" while IFS= read -r VM; do VM_ID=$(echo "${VM}" | awk -F '[{}]' '{ print $2 }') @@ -50,8 +51,7 @@ while IFS= read -r HDD; do VBoxManage closemedium disk "${HDD_ID}" --delete done < <(VBoxManage list hdds | grep '^UUID:') -test -d "${HOME}/VirtualBox VMs" && rm -r -v "${HOME}/VirtualBox VMs" - +test -d "${HOME}/VirtualBox VMs" && rm -rvf "${HOME}/VirtualBox VMs" echo "*** Remove all libvirt instances" for VM in $(virsh --connect=qemu:///system list --all --name); do @@ -62,13 +62,12 @@ for VM in $(virsh --connect=qemu:///system list --all --name); do virsh --connect=qemu:///system undefine --remove-all-storage "${VM}" done - if [[ -d "${LOGDIR}" ]]; then echo "*** Remove directory: ${LOGDIR}" - rm -rf "${LOGDIR}" + rm -rvf "${LOGDIR}" fi if [[ -d "${PACKER_IMAGES_OUTPUT_DIR}" ]]; then echo "*** Remove directory: ${PACKER_IMAGES_OUTPUT_DIR}" - rm -rf "${PACKER_IMAGES_OUTPUT_DIR}" + rm -rvf "${PACKER_IMAGES_OUTPUT_DIR}" fi diff --git a/vagrant_init_destroy_boxes.sh b/vagrant_init_destroy_boxes.sh index 98ce1b3ff..b0e350d3e 100755 --- a/vagrant_init_destroy_boxes.sh +++ b/vagrant_init_destroy_boxes.sh @@ -4,7 +4,7 @@ set -o pipefail BOXES_LIST=${*:-$(find . -maxdepth 1 \( -name "*ubuntu*.box" -o -name "*centos*.box" -o -name "*windows*.box" \) -printf "%f\n" | sort | tr "\n" " ")} TMPDIR=${TMPDIR:-/tmp} -LOGDIR=${LOGDIR:-/var/tmp/} +LOGDIR=${LOGDIR:-${TMPDIR}} export VAGRANT_IGNORE_WINRM_PLUGIN=true vagrant_box_add() {