From e2730fd9fb18582ccad44fa7bc2db96e2137092a Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Fri, 10 May 2019 07:14:15 +0200 Subject: [PATCH] fix: [deploy] There was an issue with parallel build, fixed fix: [json] The Packer variable is now set correctly --- deploy.sh | 11 ++++++----- misp.json | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index 298b16d..5a5f27c 100755 --- a/deploy.sh +++ b/deploy.sh @@ -155,6 +155,7 @@ removeAll () { rm packer_virtualbox-iso_virtualbox-iso_sha*.checksum.asc rm ${PACKER_VM}_${VER}@${LATEST_COMMIT}-vmware.zip.asc rm /tmp/LICENSE-${PACKER_NAME} + rm /tmp/vbox.done /tmp/vmware.done } # TODO: Make it more graceful if files do not exist @@ -181,16 +182,15 @@ if [[ "${LATEST_COMMIT}" != "$(cat /tmp/${PACKER_NAME}-latest.sha)" ]]; then # Build virtualbox VM set PACKER_LOG_PATH="${PWD}/packerlog-vbox.txt" - ($PACKER_RUN build --on-error=ask -only=virtualbox-iso misp-deploy.json ; VIRTUALBOX_BUILD=$? ; touch /tmp/vbox.done) & + ($PACKER_RUN build --on-error=cleanup -only=virtualbox-iso misp-deploy.json ; VIRTUALBOX_BUILD=$? ; touch /tmp/vbox.done) & # Build vmware VM set PACKER_LOG_PATH="${PWD}/packerlog-vmware.txt" - ($PACKER_RUN build --on-error=ask -only=vmware-iso misp-deploy.json ; VMWARE_BUILD=$? ; touch /tmp/vmware.done) & + ($PACKER_RUN build --on-error=cleanup -only=vmware-iso misp-deploy.json ; VMWARE_BUILD=$? ; touch /tmp/vmware.done) & # The below waits for the above 2 parallel packer builds to finish - while [[ ! -f /tmp/vbox.done ]] && [[ ! -f /tmp/vmware.done ]]; do - : - done + while [[ ! -f /tmp/vmware.done ]]; do :; done + while [[ ! -f /tmp/vbox.done ]]; do :; done # Prevent uploading only half a build if [[ "$VMWARE_BUILD" == "0" ]] && [[ "$VIRTUALBOX_BUILD" == "0" ]]; then @@ -241,6 +241,7 @@ if [[ "${LATEST_COMMIT}" != "$(cat /tmp/${PACKER_NAME}-latest.sha)" ]]; then else echo "The packer exit code of VMware was: ${VMWARE_BUILD}" echo "The packer exit code of VBox was: ${VIRTUALBOX_BUILD}" + echo "--------------------------------------------------------------------------------" echo "#fail" > /tmp/${PACKER_NAME}-latest.sha removeAll 2> /dev/null TIME_END=$(date +%s) diff --git a/misp.json b/misp.json index 5dafbd7..e8507ef 100644 --- a/misp.json +++ b/misp.json @@ -91,6 +91,7 @@ "passwd/user-password={{ user `ssh_password` }} ", "passwd/user-password-again={{ user `ssh_password` }} ", "passwd/username={{ user `ssh_username` }} ", + "debconf/frontend=noninteractive ", "-- " ] }, @@ -137,7 +138,6 @@ "environment_vars": [ "DESKTOP={{user `desktop`}}", "UPDATE={{user `update`}}", - "PACKER=1", "http_proxy={{user `http_proxy`}}", "https_proxy={{user `https_proxy`}}", "no_proxy={{user `no_proxy`}}" @@ -165,6 +165,10 @@ }, { "type": "shell", + "environment_vars": [ + "PACKER=1", + "DEBIAN_FRONTEND=noninteractive" + ], "execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -u {{user `ssh_name`}} -E -S bash '{{ .Path }}'", "inline": [ "chmod u+x /tmp/INSTALL.sh",