Created
January 31, 2019 22:16
-
-
Save anish/068a88004d5d6890eac8fa5b5e6ef9d5 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": [ | |
{ | |
"name": "gcp", | |
"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: | |
``` | |
==> gcp: Connected to SSH! | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 Running the provision hook | |
2019/01/31 14:15:23 [INFO] (telemetry) Starting provisioner file | |
==> gcp: Uploading /tmp/foo/ => /tmp | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Upload dir '/tmp/foo/' to '/tmp' | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Opening new ssh session | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Starting remote scp process: scp -rvt /tmp | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Started SCP session, beginning transfers... | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] scp: Uploading bar: perms=C0644 size=0 | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] SCP session complete, closing stdin pipe. | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Waiting for SSH session to complete. | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] scp stderr (length 18): Sink: C0644 0 bar | |
2019/01/31 14:15:23 [INFO] (telemetry) ending file | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 Executing shutdown command: shutdown -P now | |
==> gcp: Gracefully halting virtual machine... | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] Opening new ssh session | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 [DEBUG] starting remote command: shutdown -P now | |
2019/01/31 14:15:23 packer-1.3.4: 2019/01/31 14:15:23 Waiting max 10m0s for shutdown to complete | |
2019/01/31 14:15:31 packer-1.3.4: 2019/01/31 14:15:31 VM shut down. | |
2019/01/31 14:15:31 [INFO] (telemetry) ending qemu | |
2019/01/31 14:15:31 [INFO] (telemetry) Starting post-processor shell-local | |
==> gcp: Running post-processor: shell-local | |
2019/01/31 14:15:31 packer-1.3.4: 2019/01/31 14:15:31 [INFO] (shell-local): Prepending inline script with #!/bin/sh -e | |
2019/01/31 14:15:31 packer-1.3.4: 2019/01/31 14:15:31 [INFO] (shell-local): starting local command: /bin/sh -c PACKER_BUILDER_TYPE='qemu' PACKER_BUILD_NAME='gcp' /tmp/packer-shell906401770 | |
==> gcp (shell-local): Running local shell script: /tmp/packer-shell906401770 | |
2019/01/31 14:15:31 packer-1.3.4: 2019/01/31 14:15:31 [INFO] (shell-local communicator): Executing local shell command [/bin/sh -c PACKER_BUILDER_TYPE='qemu' PACKER_BUILD_NAME='gcp' /tmp/packer-shell906401770] | |
gcp (shell-local): [ 0.0] Examining the guest ... | |
gcp (shell-local): [ 4.1] Performing "logfiles" ... | |
gcp (shell-local): [ 4.1] Performing "net-hostname" ... | |
gcp (shell-local): [ 4.1] Performing "net-hwaddr" ... | |
gcp (shell-local): [ 4.1] Performing "package-manager-cache" ... | |
gcp (shell-local): [ 4.1] Performing "rpm-db" ... | |
gcp (shell-local): [ 4.1] Performing "tmp-files" ... | |
gcp (shell-local): [ 4.1] Performing "udev-persistent-net" ... | |
2019/01/31 14:15:35 [INFO] (telemetry) ending shell-local | |
2019/01/31 14:15:35 Flagging to keep original artifact from post-processor 'shell-local' | |
2019/01/31 14:15:35 Builds completed. Waiting on interrupt barrier... | |
==> Builds finished. The artifacts of successful builds are: | |
Build 'gcp' finished. | |
2019/01/31 14:15:35 machine readable: gcp,artifact-count []string{"2"} | |
==> Builds finished. The artifacts of successful builds are: | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "builder-id", "transcend.qemu"} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "id", "VM"} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "string", "VM files in directory: build-gcp-oel6-unstable"} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "files-count", "1"} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "file", "0", "build-gcp-oel6-unstable/oel6-unstable-2019.0107.raw"} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"0", "end"} | |
--> gcp: VM files in directory: build-gcp-oel6-unstable | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"1", "builder-id", ""} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"1", "id", ""} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"1", "string", ""} | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"1", "files-count", "0"} | |
--> gcp: | |
2019/01/31 14:15:35 machine readable: gcp,artifact []string{"1", "end"} | |
2019/01/31 14:15:35 [INFO] (telemetry) Finalizing. | |
2019/01/31 14:15:35 waiting for all plugin processes to complete... | |
2019/01/31 14:15:35 /usr/local/bin/packer-1.3.4: plugin process exited | |
2019/01/31 14:15:35 /usr/local/bin/packer-1.3.4: plugin process exited | |
2019/01/31 14:15:35 /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