Multiply updates
* Add simple post-processor,
for predictable qemu artifact naming
* install-recommends false for ubuntu16
* Fix zerofree for lvm based
Change-Id: Ic87d0c5e9472894714294a27d4aef797474138c6
diff --git a/common/zerodisk.sh b/common/zerodisk.sh
index 9b20b18..03f9e35 100644
--- a/common/zerodisk.sh
+++ b/common/zerodisk.sh
@@ -1,4 +1,9 @@
dd if=/dev/zero of=/EMPTY bs=1M || true
rm -f /EMPTY
+
+for m in $(cat /proc/mounts |grep '/dev/mapper/vg0' | awk '{print $2}'); do
+ dd if=/dev/zero of=${m}/EMPTY bs=1M || true
+ rm -fv ${m}/EMPTY
+done
echo 3 > /proc/sys/vm/drop_caches
sync
diff --git a/day01-image/template.json b/day01-image/template.json
index 741b7b6..881516e 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -107,6 +107,16 @@
"destination": "/etc"
}
],
+ "post-processors": [
+ {
+ "keep_input_artifact": false,
+ "output": "images/{{ user `image_name` }}.qcow2",
+ "type": "vagrant",
+ "only": [
+ "qemu"
+ ]
+ }
+ ],
"builders": [
{
"type": "qemu",
diff --git a/mirror-image/template.json b/mirror-image/template.json
index 3c13117..abd8e5a 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -111,6 +111,16 @@
"destination": "/etc/cloud/cloud.cfg"
}
],
+ "post-processors": [
+ {
+ "keep_input_artifact": false,
+ "output": "images/{{ user `image_name` }}.qcow2",
+ "type": "vagrant",
+ "only": [
+ "qemu"
+ ]
+ }
+ ],
"builders": [
{
"type": "openstack",
diff --git a/packer-image-buid.groovy b/packer-image-buid.groovy
index a87918f..b3d1dad 100644
--- a/packer-image-buid.groovy
+++ b/packer-image-buid.groovy
@@ -237,8 +237,8 @@
// collect artifacts
// TODO make it possible, process multiply artifacts by one run.
dir('images/') {
- sh(script: 'find .', returnStdout: true)
- def _files = findFiles(glob: "*qemu*/${imageName}*")
+ sh(script: 'find .')
+ def _files = findFiles(glob: "*${imageName}*.qcow2")
if (_files.size() > 1) {
common.warningMsg("Multiply artifacts detected!Only first one will be processed!")
} else if (_files.size() == 0) {
diff --git a/trymcp-day01-image/template.json b/trymcp-day01-image/template.json
index 84f0a8e..9e28010 100644
--- a/trymcp-day01-image/template.json
+++ b/trymcp-day01-image/template.json
@@ -89,6 +89,16 @@
"destination": "/etc"
}
],
+ "post-processors": [
+ {
+ "keep_input_artifact": false,
+ "output": "images/{{ user `image_name` }}.qcow2",
+ "type": "vagrant",
+ "only": [
+ "qemu"
+ ]
+ }
+ ],
"builders": [
{
"type": "qemu",
@@ -127,4 +137,4 @@
"ssh_wait_timeout": "360s"
}
]
-}
\ No newline at end of file
+}
diff --git a/ubuntu-16.04/http/preseed.cfg b/ubuntu-16.04/http/preseed.cfg
index ed89955..a736274 100644
--- a/ubuntu-16.04/http/preseed.cfg
+++ b/ubuntu-16.04/http/preseed.cfg
@@ -1,6 +1,7 @@
choose-mirror-bin mirror/http/proxy string
d-i mirror/country string manual
d-i apt-setup/use_mirror boolean false
+d-i base-installer/install-recommends boolean false
d-i debian-installer/locale string en_US
d-i debian-installer/language string en
diff --git a/ubuntu-16.04/run.example.sh b/ubuntu-16.04/run.example.sh
index 2ed17e0..7341ce7 100755
--- a/ubuntu-16.04/run.example.sh
+++ b/ubuntu-16.04/run.example.sh
@@ -25,6 +25,6 @@
[ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso
mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive
# For qemu test-build:
-packer build -only=qemu -parallel=false -on-error=ask template.json
+packer build -machine-readable -only=qemu -parallel=false -on-error=ask template.json
#rm -rf ~/.packer.d/
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index 7b87e75..71e67f3 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -132,6 +132,14 @@
"only": [
"docker"
]
+ },
+ {
+ "keep_input_artifact": false,
+ "output": "images/{{ user `image_name` }}.qcow2",
+ "type": "vagrant",
+ "only": [
+ "qemu"
+ ]
}
],
"builders": [