Add local basebuild variant for testing 63/6663/1
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>
Fri, 30 Sep 2016 12:18:42 +0000 (14:18 +0200)
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>
Fri, 30 Sep 2016 12:18:42 +0000 (14:18 +0200)
Run with:
packer build -var-file=vars/cloud-env.json -var-file=vars/ubuntu-16.04.json templates/basebuild-local-kvm.json

Change-Id: I15ed4eb3c7f74c7d11095ffe8a543b0b7ba4c7f8
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
.gitignore
packer/httpdir/preseed.cfg [new file with mode: 0644]
packer/templates/basebuild-local-kvm.json [new file with mode: 0644]

index 51ff612..b574f48 100644 (file)
@@ -16,3 +16,7 @@ target/
 # IntelliJ
 .idea/
 *.iml
+
+# packer local run
+packer/output_ubuntu
+packer/packer_cache
diff --git a/packer/httpdir/preseed.cfg b/packer/httpdir/preseed.cfg
new file mode 100644 (file)
index 0000000..0674f45
--- /dev/null
@@ -0,0 +1,24 @@
+choose-mirror-bin mirror/http/proxy string
+d-i debian-installer/framebuffer boolean false
+d-i debconf/frontend select noninteractive
+d-i base-installer/kernel/override-image string linux-server
+d-i clock-setup/utc boolean true
+d-i clock-setup/utc-auto boolean true
+d-i finish-install/reboot_in_progress note
+d-i grub-installer/only_debian boolean true
+d-i grub-installer/with_other_os boolean true
+d-i netcfg/get_domain string unassigned-domain
+d-i netcfg/get_hostname string unassigned-hostname
+d-i partman-auto/method string regular
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+d-i partman/confirm_write_new_label boolean true
+d-i pkgsel/include string openssh-server
+d-i pkgsel/install-language-support boolean false
+d-i pkgsel/update-policy select unattended-upgrades
+d-i pkgsel/upgrade select none
+d-i time/zone string CET
+d-i user-setup/allow-password-weak boolean true
+d-i user-setup/encrypt-home boolean false
+tasksel tasksel/first multiselect standard, ubuntu-server
diff --git a/packer/templates/basebuild-local-kvm.json b/packer/templates/basebuild-local-kvm.json
new file mode 100644 (file)
index 0000000..4c36ddd
--- /dev/null
@@ -0,0 +1,85 @@
+{
+  "variables": {
+    "stack_tenant": null,
+    "stack_user": null,
+    "stack_pass": null,
+    "stack_network": null,
+
+    "base_image": null,
+    "cloud_user": null,
+    "distro": null,
+    "cloud_user_data": null
+  },
+  "builders": [
+{
+      "type": "qemu",
+      "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04-server-amd64.iso",
+      "iso_checksum": "23e97cd5d4145d4105fbf29878534049",
+      "iso_checksum_type": "md5",
+
+      "output_directory": "output_ubuntu",
+
+      "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -P now",
+
+      "disk_size": 20000,
+      "format": "qcow2",
+      "headless": false,
+      "accelerator": "kvm",
+
+      "http_directory": "httpdir",
+      "http_port_min": 10082,
+      "http_port_max": 10089,
+      "ssh_host_port_min": 2222,
+      "ssh_host_port_max": 2229,
+      "ssh_username": "ubuntu",
+      "ssh_password": "ubuntu",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "11m",
+
+      "vm_name": "jenkins-new-test",
+      "net_device": "virtio-net",
+      "disk_interface": "virtio",
+      "boot_wait": "5s",
+
+      "boot_command": [
+                "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+                "/install/vmlinuz url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
+                "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
+                "hostname=jenkinstest ",
+
+                "keyboard-configuration/modelcode=SKIP ",
+                "keyboard-configuration/layout=USA ",
+                "keyboard-configuration/variant=USA ",
+
+                "passwd/user-fullname=ubuntu ",
+                "passwd/user-password-again=ubuntu ",
+                "passwd/user-password=ubuntu ",
+                "passwd/username=ubuntu ",
+
+                "initrd=/install/initrd.gz -- <enter>"
+      ]
+
+    }
+  ],
+  "provisioners": [
+    {
+      "type": "shell",
+      "inline": ["mkdir -p /tmp/packer"]
+    },
+    {
+      "type": "file",
+      "source": "provision/basebuild/",
+      "destination": "/tmp/packer"
+    },
+    {
+      "type": "shell",
+      "scripts": [
+        "provision/baseline.sh",
+        "provision/basebuild.sh",
+        "provision/agl_dependencies.sh",
+        "provision/system_reseal.sh"
+      ],
+      "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else echo 'ubuntu' | {{ .Vars }} sudo -S -E sh '{{ .Path }}'; fi"
+    }
+  ]
+}