Created
January 31, 2019 22:13
-
-
Save anish/fa5681bd89e99652f217b9f7fbc92483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
{ | |
"variables": { | |
"build_target" : "foo-current", | |
"build_patch": "2019.01", | |
"default_ssh_user" : "root", | |
"default_password": null | |
}, | |
"builders": [ | |
{ | |
"name": "gcp", | |
"type": "qemu", | |
"boot_wait": "3s", | |
"disk_image": "true", | |
"iso_url": "foo.raw", | |
"iso_checksum_type": "none", | |
"accelerator": "kvm", | |
"vm_name": "{{user `build_target` }}-{{user `build_patch` }}.raw", | |
"machine_type": "pc", | |
"disk_interface": "virtio", | |
"disk_compression": "true", | |
"format": "raw", | |
"net_device": "virtio-net-pci", | |
"ssh_username": "{{user `default_ssh_user`}}", | |
"ssh_password": "{{user `default_password`}}", | |
"headless": "false", | |
"boot_command": "<tab><wait> e <wait><down><wait> e <wait><wait><wait> cc: url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/allowlogin.cfg <enter> b", | |
"http_directory": "configs", | |
"disk_size": "32768", | |
"qemuargs": [ | |
["-m", "2048"], | |
["-k", "en-us"] | |
], | |
"shutdown_command": "shutdown -P now", | |
"shutdown_timeout": "10m", | |
"output_directory": "build-{{build_name}}-{{user `build_target`}}" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "file", | |
"only" : [ | |
"gcp" | |
], | |
"source": "/tmp/foo/", | |
"destination": "/tmp", | |
"direction": "upload" | |
} | |
], | |
"post-processors": [ | |
{ | |
"type": "shell-local", | |
"only": [ | |
"gcp" | |
], | |
"inline": [ "virt-sysprep --enable net-hostname,net-hwaddr,udev-persistent-net,logfiles,tmp-files,package-manager-cache,rpm-db -a build-{{build_name}}-{{user `build_target`}}/{{user `build_target` }}-{{user `build_patch`}}.raw" ] | |
} | |
] | |
} | |
``` | |
debug output: | |
``` | |
2019/01/31 14:09:05 packer-1.3.4: 2019/01/31 14:09:05 [INFO] Waiting for SSH, up to timeout: 5m0s | |
==> gcp: Using ssh communicator to connect: 127.0.0.1 | |
==> gcp: Waiting for SSH to become available... | |
2019/01/31 14:09:05 packer-1.3.4: 2019/01/31 14:09:05 [INFO] Attempting SSH connection... | |
2019/01/31 14:09:05 packer-1.3.4: 2019/01/31 14:09:05 [DEBUG] reconnecting to TCP connection for SSH | |
2019/01/31 14:09:05 packer-1.3.4: 2019/01/31 14:09:05 [DEBUG] handshaking with SSH | |
2019/01/31 14:09:23 packer-1.3.4: 2019/01/31 14:09:23 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:33578->127.0.0.1:3977: read: connection reset by peer | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [INFO] Attempting SSH connection... | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] reconnecting to TCP connection for SSH | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] handshaking with SSH | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] handshake complete! | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Opening new ssh session | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [INFO] agent forwarding enabled | |
==> gcp: Connected to SSH! | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 Running the provision hook | |
2019/01/31 14:09:30 [INFO] (telemetry) Starting provisioner file | |
==> gcp: Uploading /tmp/foo/ => /tmp | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Upload dir '/tmp/foo/' to '/tmp' | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Opening new ssh session | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Starting remote scp process: scp -rvt /tmp | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Started SCP session, beginning transfers... | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] scp: Uploading bar: perms=C0644 size=0 | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] SCP session complete, closing stdin pipe. | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Waiting for SSH session to complete. | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] scp stderr (length 18): Sink: C0644 0 bar | |
2019/01/31 14:09:30 [INFO] (telemetry) ending file | |
==> gcp: Gracefully halting virtual machine... | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 Executing shutdown command: shutdown -P now | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] Opening new ssh session | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 [DEBUG] starting remote command: shutdown -P now | |
2019/01/31 14:09:30 packer-1.3.4: 2019/01/31 14:09:30 Waiting max 10m0s for shutdown to complete | |
2019/01/31 14:09:38 packer-1.3.4: 2019/01/31 14:09:38 VM shut down. | |
2019/01/31 14:09:38 [INFO] (telemetry) ending qemu | |
2019/01/31 14:09:38 Builds completed. Waiting on interrupt barrier... | |
==> Builds finished. The artifacts of successful builds are: | |
2019/01/31 14:09:38 machine readable: gcp,artifact-count []string{"1"} | |
Build 'gcp' finished. | |
==> Builds finished. The artifacts of successful builds are: | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "builder-id", "transcend.qemu"} | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "id", "VM"} | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "string", "VM files in directory: build-gcp-foo-current"} | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "files-count", "1"} | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "file", "0", "build-gcp-foo-current/foo-current-2019.0107.raw"} | |
2019/01/31 14:09:38 machine readable: gcp,artifact []string{"0", "end"} | |
2019/01/31 14:09:38 [INFO] (telemetry) Finalizing. | |
--> gcp: VM files in directory: build-gcp-foo-current | |
2019/01/31 14:09:39 waiting for all plugin processes to complete... | |
2019/01/31 14:09:39 /usr/local/bin/packer-1.3.4: plugin process exited | |
2019/01/31 14:09:39 /usr/local/bin/packer-1.3.4: plugin process exited | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment