From a54c334c6d86eed6d159e91e958d9cc610c31d83 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Thu, 12 Nov 2015 17:12:57 -0800 Subject: [PATCH 01/23] Add GH-2718 to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6399411ce..0c0f60552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ IMPROVEMENTS: * builder/qemu: qcow2 images can now be compressed [GH-2748] * builder/qemu: Now specifies `virtio-scsi` by default [GH-2422] * builder/qemu: Now checks for version-specific options [GH-2376] + * builder/docker-import: Can now import Artifice artifacts [GH-2718] * provisioner/puppet: Now accepts the `extra_arguments` parameter [GH-2635] * post-processor/atlas: Added support for compile ID. [GH-2775] From 49ded7f79f8166d00cc3564705cc3b35a62f366c Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Fri, 13 Nov 2015 13:57:52 -0500 Subject: [PATCH 02/23] Grammar change --- website/source/docs/templates/post-processors.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/templates/post-processors.html.markdown b/website/source/docs/templates/post-processors.html.markdown index c6926b5f1..7065b4dae 100644 --- a/website/source/docs/templates/post-processors.html.markdown +++ b/website/source/docs/templates/post-processors.html.markdown @@ -82,7 +82,7 @@ sequence definition. Sequence definitions are used to chain together multiple post-processors. An example is shown below, where the artifact of a build is compressed then uploaded, but the compressed result is not kept. -It is very important that any post processors that need to be ran in order, be sequenced! +It is very important that any post processors that need to be run in order, be sequenced! ``` {.javascript} { From 3d23655f2f42523e4f9d278e8603517751fe3800 Mon Sep 17 00:00:00 2001 From: David Zanetti Date: Mon, 16 Nov 2015 16:37:09 +1300 Subject: [PATCH 03/23] Add "noclean" boolean to shell provisioner. This stops the provisioner from attempting to remove helper scripts it creates. As noted on #2803 this can be useful when deleting the build user from an AMI or other template. --- provisioner/shell/provisioner.go | 50 +++++++++++-------- .../docs/provisioners/shell.html.markdown | 4 ++ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 3c32b3fc2..82d084d25 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -58,6 +58,9 @@ type Config struct { // This can be set high to allow for reboots. RawStartRetryTimeout string `mapstructure:"start_retry_timeout"` + // Whether to clean scripts up + NoClean bool + startRetryTimeout time.Duration ctx interpolate.Context } @@ -271,29 +274,32 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Script exited with non-zero exit status: %d", cmd.ExitStatus) } - // Delete the temporary file we created. We retry this a few times - // since if the above rebooted we have to wait until the reboot - // completes. - err = p.retryable(func() error { - cmd = &packer.RemoteCmd{ - Command: fmt.Sprintf("rm -f %s", p.config.RemotePath), - } - if err := comm.Start(cmd); err != nil { - return fmt.Errorf( - "Error removing temporary script at %s: %s", - p.config.RemotePath, err) - } - cmd.Wait() - return nil - }) - if err != nil { - return err - } + if !p.config.NoClean { - if cmd.ExitStatus != 0 { - return fmt.Errorf( - "Error removing temporary script at %s!", - p.config.RemotePath) + // Delete the temporary file we created. We retry this a few times + // since if the above rebooted we have to wait until the reboot + // completes. + err = p.retryable(func() error { + cmd = &packer.RemoteCmd{ + Command: fmt.Sprintf("rm -f %s", p.config.RemotePath), + } + if err := comm.Start(cmd); err != nil { + return fmt.Errorf( + "Error removing temporary script at %s: %s", + p.config.RemotePath, err) + } + cmd.Wait() + return nil + }) + if err != nil { + return err + } + + if cmd.ExitStatus != 0 { + return fmt.Errorf( + "Error removing temporary script at %s!", + p.config.RemotePath) + } } } diff --git a/website/source/docs/provisioners/shell.html.markdown b/website/source/docs/provisioners/shell.html.markdown index 9cd05ef12..c7ee7143a 100644 --- a/website/source/docs/provisioners/shell.html.markdown +++ b/website/source/docs/provisioners/shell.html.markdown @@ -88,6 +88,10 @@ Optional parameters: system reboot. Set this to a higher value if reboots take a longer amount of time. +- `noclean` (boolean) - If true, specifies that the helper scripts uploaded + to the system will not be removed by Packer. This defaults to false + (clean scripts from the system). + ## Execute Command Example To many new users, the `execute_command` is puzzling. However, it provides an From bdf68c14a8d1964f866374387b3e1a9275b0974a Mon Sep 17 00:00:00 2001 From: David Zanetti Date: Tue, 17 Nov 2015 16:01:28 +1300 Subject: [PATCH 04/23] Update documentation of shell remote_path variable It is not a path as implied by docs, but a specific filename. Update default to currently implemented default. --- website/source/docs/provisioners/shell.html.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/source/docs/provisioners/shell.html.markdown b/website/source/docs/provisioners/shell.html.markdown index 9cd05ef12..eb5f36d9e 100644 --- a/website/source/docs/provisioners/shell.html.markdown +++ b/website/source/docs/provisioners/shell.html.markdown @@ -78,9 +78,10 @@ Optional parameters: **Important:** If you customize this, be sure to include something like the `-e` flag, otherwise individual steps failing won't fail the provisioner. -- `remote_path` (string) - The path where the script will be uploaded to in - the machine. This defaults to "/tmp/script.sh". This value must be a - writable location and any parent directories must already exist. +- `remote_path` (string) - The filename where the script will be uploaded + to in the machine. This defaults to "/tmp/script_nnn.sh" where "nnn" is + a randomly generated number. This value must be a writable location and + any parent directories must already exist. - `start_retry_timeout` (string) - The amount of time to attempt to *start* the remote process. By default this is "5m" or 5 minutes. This setting From 2668747c71a441f029c17388d3a5ce7b6a8b614f Mon Sep 17 00:00:00 2001 From: David Zanetti Date: Thu, 19 Nov 2015 16:02:45 +1300 Subject: [PATCH 05/23] Rename noclean shell option to skip_clean, per pull feedback --- provisioner/shell/provisioner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 82d084d25..78826b638 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -59,7 +59,7 @@ type Config struct { RawStartRetryTimeout string `mapstructure:"start_retry_timeout"` // Whether to clean scripts up - NoClean bool + SkipClean bool `mapstructure:"skip_clean"` startRetryTimeout time.Duration ctx interpolate.Context @@ -274,7 +274,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Script exited with non-zero exit status: %d", cmd.ExitStatus) } - if !p.config.NoClean { + if !p.config.SkipClean { // Delete the temporary file we created. We retry this a few times // since if the above rebooted we have to wait until the reboot From 6c121fa35bccca7ac75eb3bd37e967d2cc52d048 Mon Sep 17 00:00:00 2001 From: David Zanetti Date: Thu, 19 Nov 2015 16:06:59 +1300 Subject: [PATCH 06/23] Change shell doc from 'noclean' to 'skip_clean' --- website/source/docs/provisioners/shell.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/source/docs/provisioners/shell.html.markdown b/website/source/docs/provisioners/shell.html.markdown index c7ee7143a..f01a7eb9b 100644 --- a/website/source/docs/provisioners/shell.html.markdown +++ b/website/source/docs/provisioners/shell.html.markdown @@ -88,9 +88,9 @@ Optional parameters: system reboot. Set this to a higher value if reboots take a longer amount of time. -- `noclean` (boolean) - If true, specifies that the helper scripts uploaded - to the system will not be removed by Packer. This defaults to false - (clean scripts from the system). +- `skip_clean` (boolean) - If true, specifies that the helper scripts + uploaded to the system will not be removed by Packer. This defaults to + false (clean scripts from the system). ## Execute Command Example From bb34c7ec58bd23507faa74309fcd2dd1bb18e63d Mon Sep 17 00:00:00 2001 From: Pierre-Etienne Poirot Date: Mon, 23 Nov 2015 14:19:15 +1100 Subject: [PATCH 07/23] Add a notice that Ansible needs to be already present on the target. Like the 'puppet-masterless' and 'puppet-server' provisioners (and unlike the 'chef-solo' and 'chef-client' provisioners), the 'ansible-local' currently requires Ansible to be present on the provisioned image. The relevant issue to add an install option to the provisioner is: https://github.com/mitchellh/packer/issues/2010 Until then, a notice similar to the 'puppet-masterless' and 'puppet-server' ones is added. --- .../source/docs/provisioners/ansible-local.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/website/source/docs/provisioners/ansible-local.html.markdown b/website/source/docs/provisioners/ansible-local.html.markdown index c0cec6641..8c638954a 100644 --- a/website/source/docs/provisioners/ansible-local.html.markdown +++ b/website/source/docs/provisioners/ansible-local.html.markdown @@ -18,6 +18,12 @@ uploaded from your local machine to the remote machine. Ansible is run in [local mode](http://docs.ansible.com/playbooks_delegation.html#local-playbooks) via the `ansible-playbook` command. +-> **Note:** Ansible will *not* be installed automatically by this +provisioner. This provisioner expects that Ansible is already installed on the +machine. It is common practice to use the [shell +provisioner](/docs/provisioners/shell.html) before the Ansible provisioner to do +this. + ## Basic Example The example below is fully functional. From 4baaad2530cf04f9936fb822fb0c90d3947bbf60 Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Tue, 24 Nov 2015 10:31:31 +0300 Subject: [PATCH 08/23] duplicated word --- website/source/docs/post-processors/atlas.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/post-processors/atlas.html.markdown b/website/source/docs/post-processors/atlas.html.markdown index 705623131..7940b42bc 100644 --- a/website/source/docs/post-processors/atlas.html.markdown +++ b/website/source/docs/post-processors/atlas.html.markdown @@ -12,7 +12,7 @@ page_title: 'Atlas Post-Processor' Type: `atlas` The Atlas post-processor uploads artifacts from your packer builds to Atlas for -hosting. Artifacts hosted in Atlas are are automatically made available for use +hosting. Artifacts hosted in Atlas are automatically made available for use with Vagrant and Terraform, and Atlas provides additional features for managing versions and releases. [Learn more about packer in Atlas.](https://atlas.hashicorp.com/help/packer/features) From d67d2b9d6b386c7c3fc42a16e3475de7964268ab Mon Sep 17 00:00:00 2001 From: Hiroyuki MORITA Date: Wed, 25 Nov 2015 03:39:06 +0900 Subject: [PATCH 09/23] ansible-local doc is not styled https://www.packer.io/docs/provisioners/ansible-local.html#inventory_file --- website/source/docs/provisioners/ansible-local.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/source/docs/provisioners/ansible-local.html.markdown b/website/source/docs/provisioners/ansible-local.html.markdown index c0cec6641..aa2641db2 100644 --- a/website/source/docs/provisioners/ansible-local.html.markdown +++ b/website/source/docs/provisioners/ansible-local.html.markdown @@ -67,6 +67,7 @@ specified host you're buiding. The `--limit` argument can be provided in the `extra_arguments` option. An example inventory file may look like: + ```{.text} [chi-dbservers] db-01 ansible_connection=local From 051f7d6ee65892182e4bc0fe0b4eb3c081a04216 Mon Sep 17 00:00:00 2001 From: Cameron Stokes Date: Wed, 2 Dec 2015 18:59:34 -0800 Subject: [PATCH 10/23] note about Docker Hub login requirements --- website/source/docs/post-processors/docker-push.html.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/website/source/docs/post-processors/docker-push.html.markdown b/website/source/docs/post-processors/docker-push.html.markdown index 9657e27b7..938521629 100644 --- a/website/source/docs/post-processors/docker-push.html.markdown +++ b/website/source/docs/post-processors/docker-push.html.markdown @@ -29,6 +29,10 @@ This post-processor has only optional configuration: - `login_server` (string) - The server address to login to. +Note: When using _Docker Hub_, `login` must to be set to `true` and `login_email`, +`login_username`, **and** `login_password` must to be set to your Docker Hub +credentials. `login_server` can be omitted. + -> **Note:** If you login using the credentials above, the post-processor will automatically log you out afterwards (just the server specified). From adf4764c8268f8d381e8ce029ae6d3058ea6e8e2 Mon Sep 17 00:00:00 2001 From: Cameron Stokes Date: Wed, 2 Dec 2015 19:06:37 -0800 Subject: [PATCH 11/23] note about Quay login credentials --- .../source/docs/post-processors/docker-push.html.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/source/docs/post-processors/docker-push.html.markdown b/website/source/docs/post-processors/docker-push.html.markdown index 938521629..3a5247320 100644 --- a/website/source/docs/post-processors/docker-push.html.markdown +++ b/website/source/docs/post-processors/docker-push.html.markdown @@ -29,9 +29,10 @@ This post-processor has only optional configuration: - `login_server` (string) - The server address to login to. -Note: When using _Docker Hub_, `login` must to be set to `true` and `login_email`, -`login_username`, **and** `login_password` must to be set to your Docker Hub -credentials. `login_server` can be omitted. +Note: When using _Docker Hub_ or _Quay_ registry servers, `login` must to be +set to `true` and `login_email`, `login_username`, **and** `login_password` +must to be set to your registry credentials. When using Docker Hub, +`login_server` can be omitted. -> **Note:** If you login using the credentials above, the post-processor will automatically log you out afterwards (just the server specified). From afd314959b8d0796da989c2229040defffbd5d00 Mon Sep 17 00:00:00 2001 From: YAMADA Tsuyoshi Date: Sat, 5 Dec 2015 05:13:35 +0900 Subject: [PATCH 12/23] supported `preemptible` in googlecompute builder --- builder/googlecompute/config.go | 1 + builder/googlecompute/driver.go | 1 + builder/googlecompute/driver_gce.go | 3 +++ builder/googlecompute/step_create_instance.go | 1 + 4 files changed, 6 insertions(+) diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index 4ca45c69f..e79a92e64 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -31,6 +31,7 @@ type Config struct { MachineType string `mapstructure:"machine_type"` Metadata map[string]string `mapstructure:"metadata"` Network string `mapstructure:"network"` + Preemptible bool `mapstructure:"preemptible"` SourceImage string `mapstructure:"source_image"` SourceImageProjectId string `mapstructure:"source_image_project_id"` RawStateTimeout string `mapstructure:"state_timeout"` diff --git a/builder/googlecompute/driver.go b/builder/googlecompute/driver.go index be697fe6b..6a9c3d651 100644 --- a/builder/googlecompute/driver.go +++ b/builder/googlecompute/driver.go @@ -47,6 +47,7 @@ type InstanceConfig struct { Metadata map[string]string Name string Network string + Preemptible bool Tags []string Zone string } diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index d7b745d58..b1e4d8d45 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -255,6 +255,9 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { Network: network.SelfLink, }, }, + Scheduling: &compute.Scheduling{ + Preemptible: c.Preemptible, + }, ServiceAccounts: []*compute.ServiceAccount{ &compute.ServiceAccount{ Email: "default", diff --git a/builder/googlecompute/step_create_instance.go b/builder/googlecompute/step_create_instance.go index 939925c58..891072438 100644 --- a/builder/googlecompute/step_create_instance.go +++ b/builder/googlecompute/step_create_instance.go @@ -59,6 +59,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction Metadata: config.getInstanceMetadata(sshPublicKey), Name: name, Network: config.Network, + Preemptible: config.Preemptible, Tags: config.Tags, Zone: config.Zone, }) From 18d79cfb3dce7ecda978ce41679f805145613661 Mon Sep 17 00:00:00 2001 From: YAMADA Tsuyoshi Date: Sat, 5 Dec 2015 14:17:42 +0900 Subject: [PATCH 13/23] added test --- builder/googlecompute/config_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/builder/googlecompute/config_test.go b/builder/googlecompute/config_test.go index 581c1425b..372c85004 100644 --- a/builder/googlecompute/config_test.go +++ b/builder/googlecompute/config_test.go @@ -93,6 +93,21 @@ func TestConfigPrepare(t *testing.T) { "SO VERY BAD", true, }, + { + "preemptible", + nil, + false, + }, + { + "preemptible", + false, + false, + }, + { + "preemptible", + "SO VERY BAD", + true, + }, } for _, tc := range cases { From ca43e89aa73d1c35adeeaae8bd3ee72417caf98a Mon Sep 17 00:00:00 2001 From: YAMADA Tsuyoshi Date: Sat, 5 Dec 2015 14:17:55 +0900 Subject: [PATCH 14/23] added document --- website/source/docs/builders/googlecompute.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/source/docs/builders/googlecompute.html.markdown b/website/source/docs/builders/googlecompute.html.markdown index c97cd672a..fe45ee01b 100644 --- a/website/source/docs/builders/googlecompute.html.markdown +++ b/website/source/docs/builders/googlecompute.html.markdown @@ -144,6 +144,8 @@ builder. - `use_internal_ip` (boolean) - If true, use the instance's internal IP instead of its external IP during building. +- `preemptible` (boolean) - If true, launch a preembtible instance. + ## Gotchas Centos images have root ssh access disabled by default. Set `ssh_username` to From b57140da4789b7b61ed6ad63f31920f1b5d3f2b8 Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Tue, 8 Dec 2015 12:45:26 +0000 Subject: [PATCH 15/23] Add support for using cloud-init via a ConfigDrive Signed-off-by: Ian Duffy --- builder/openstack/builder.go | 1 + builder/openstack/run_config.go | 2 ++ builder/openstack/step_run_source_server.go | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index 9f4c9e7bc..72610e73e 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -88,6 +88,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe AvailabilityZone: b.config.AvailabilityZone, UserData: b.config.UserData, UserDataFile: b.config.UserDataFile, + ConfigDrive: b.config.ConfigDrive, }, &StepWaitForRackConnect{ Wait: b.config.RackconnectWait, diff --git a/builder/openstack/run_config.go b/builder/openstack/run_config.go index a8b8638dc..536245323 100644 --- a/builder/openstack/run_config.go +++ b/builder/openstack/run_config.go @@ -25,6 +25,8 @@ type RunConfig struct { UserData string `mapstructure:"user_data"` UserDataFile string `mapstructure:"user_data_file"` + ConfigDrive bool `mapstructure:"config_drive"` + // Not really used, but here for BC OpenstackProvider string `mapstructure:"openstack_provider"` UseFloatingIp bool `mapstructure:"use_floating_ip"` diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index f78fe4f90..77e652dd5 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -19,8 +19,8 @@ type StepRunSourceServer struct { AvailabilityZone string UserData string UserDataFile string - - server *servers.Server + ConfigDrive bool + server *servers.Server } func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction { @@ -62,6 +62,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction Networks: networks, AvailabilityZone: s.AvailabilityZone, UserData: userData, + ConfigDrive: s.ConfigDrive, }, KeyName: keyName, From 4b88403690b21eff0b6efcb4986c2b21aaf9e31f Mon Sep 17 00:00:00 2001 From: BetaGrumm Date: Wed, 9 Dec 2015 11:49:04 -0800 Subject: [PATCH 16/23] Update file.html.markdown Fixed typo: Missing "i" in the word "will". --- website/source/docs/provisioners/file.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/provisioners/file.html.markdown b/website/source/docs/provisioners/file.html.markdown index 7799721a5..bb66fc220 100644 --- a/website/source/docs/provisioners/file.html.markdown +++ b/website/source/docs/provisioners/file.html.markdown @@ -44,7 +44,7 @@ The available configuration options are listed below. All elements are required. - `direction` (string) - The direction of the file transfer. This defaults to "upload." If it is set to "download" then the file "source" in the machine - wll be downloaded locally to "destination" + will be downloaded locally to "destination" ## Directory Uploads From 7271b6ac8d0e88a33a5dbb4e83e1a41e2b659be3 Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Wed, 9 Dec 2015 22:28:47 +0000 Subject: [PATCH 17/23] Add documentation for config_drive Signed-off-by: Ian Duffy --- website/source/docs/builders/openstack.html.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/source/docs/builders/openstack.html.markdown b/website/source/docs/builders/openstack.html.markdown index 12a1ca882..cb54b52d2 100644 --- a/website/source/docs/builders/openstack.html.markdown +++ b/website/source/docs/builders/openstack.html.markdown @@ -103,6 +103,9 @@ builder. - `metadata` (object of key/value strings) - Glance metadata that will be applied to the image. +- `config_drive` (boolean) - Whether or not nova should use ConfigDrive for + cloud-init metadata. + ## Basic Example: Rackspace public cloud Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS From 1b0ea606f8e7fca7d4426ba56c1e1209968496bb Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Wed, 9 Dec 2015 20:15:37 -0800 Subject: [PATCH 18/23] Go 1.5 should pass, since we do release builds with this now --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 497bbe1ba..5880a73a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,3 @@ matrix: fast_finish: true allow_failures: - go: tip - - go: 1.5 From 8d574962d95b4ab8c4c77a192fab370985b849ad Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Mon, 14 Dec 2015 14:35:29 -0800 Subject: [PATCH 19/23] Added preemptible GCE instances to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c0f60552..990efe9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ IMPROVEMENTS: * builder/amazon: Add support for `ebs_optimized` [GH-2806] * builder/amazon: You can now specify `0` for `spot_price` to switch to on demand instances [GH-2845] * builder/google: `account_file` can now be provided as a JSON string [GH-2811] + * builder/google: added support for `preemptible` instances [GH-2982] * builder/parallels: Improve support for Parallels 11 [GH-2662] * builder/parallels: Parallels disks are now compacted by default [GH-2731] * builder/parallels: Packer will look for Parallels in `/Applications/Parallels Desktop.app` if it is not detected automatically [GH-2839] From 2212125f4657ff3494846e9b1790ff114a51aea7 Mon Sep 17 00:00:00 2001 From: Andrew Starr-Bochicchio Date: Tue, 15 Dec 2015 12:00:04 -0500 Subject: [PATCH 20/23] Return DigitalOcean image ID in output. --- builder/digitalocean/artifact.go | 2 +- builder/digitalocean/artifact_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/digitalocean/artifact.go b/builder/digitalocean/artifact.go index 6abb561c9..8f6e81161 100644 --- a/builder/digitalocean/artifact.go +++ b/builder/digitalocean/artifact.go @@ -36,7 +36,7 @@ func (a *Artifact) Id() string { } func (a *Artifact) String() string { - return fmt.Sprintf("A snapshot was created: '%v' in region '%v'", a.snapshotName, a.regionName) + return fmt.Sprintf("A snapshot was created: '%v' (ID: %v) in region '%v'", a.snapshotName, a.snapshotId, a.regionName) } func (a *Artifact) State(name string) interface{} { diff --git a/builder/digitalocean/artifact_test.go b/builder/digitalocean/artifact_test.go index 7ea586111..d8523154d 100644 --- a/builder/digitalocean/artifact_test.go +++ b/builder/digitalocean/artifact_test.go @@ -25,7 +25,7 @@ func TestArtifactId(t *testing.T) { func TestArtifactString(t *testing.T) { a := &Artifact{"packer-foobar", 42, "San Francisco", nil} - expected := "A snapshot was created: 'packer-foobar' in region 'San Francisco'" + expected := "A snapshot was created: 'packer-foobar' (ID: 42) in region 'San Francisco'" if a.String() != expected { t.Fatalf("artifact string should match: %v", expected) From eaa088b491a865b5b76d322f96071237b00f0b0d Mon Sep 17 00:00:00 2001 From: Asfand Yar Qazi Date: Tue, 15 Dec 2015 22:33:19 +0000 Subject: [PATCH 21/23] README.md quick-start builder example made more secure Adding credentials to a file that may get committed to a git repository is dangerous; make the example follow best practices and pull the AWS credentials out of the environment --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fd562eb9a..fa23df693 100644 --- a/README.md +++ b/README.md @@ -42,15 +42,19 @@ for your operating system or [compile Packer yourself](#developing-packer). After Packer is installed, create your first template, which tells Packer what platforms to build images for and how you want to build them. In our case, we'll create a simple AMI that has Redis pre-installed. Save this -file as `quick-start.json`. Be sure to replace any credentials with your -own. +file as `quick-start.json`. Export your AWS credentials as the +`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. ```json { + "variables": { + "access_key": "{{env `AWS_ACCESS_KEY_ID`}}", + "secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}" + }, "builders": [{ "type": "amazon-ebs", - "access_key": "YOUR KEY HERE", - "secret_key": "YOUR SECRET KEY HERE", + "access_key": "{{user `access_key`}}", + "secret_key": "{{user `access_key`}}", "region": "us-east-1", "source_ami": "ami-de0d9eb7", "instance_type": "t1.micro", From 39d6eda3708dc677544f0afe1b5e35911152bd86 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 17 Dec 2015 11:12:52 -0800 Subject: [PATCH 22/23] Make the OpenStack builder more informative about the servers, images, and keypairs that it's dealing with. --- builder/openstack/step_create_image.go | 2 +- builder/openstack/step_key_pair.go | 6 ++++-- builder/openstack/step_run_source_server.go | 2 +- builder/openstack/step_stop_server.go | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/builder/openstack/step_create_image.go b/builder/openstack/step_create_image.go index 9b6ac0cd8..61607b2f2 100644 --- a/builder/openstack/step_create_image.go +++ b/builder/openstack/step_create_image.go @@ -45,7 +45,7 @@ func (s *stepCreateImage) Run(state multistep.StateBag) multistep.StepAction { state.Put("image", imageId) // Wait for the image to become ready - ui.Say("Waiting for image to become ready...") + ui.Say(fmt.Sprintf("Waiting for image %s (image id: %s) to become ready...", config.ImageName, imageId)) if err := WaitForImage(client, imageId); err != nil { err := fmt.Errorf("Error waiting for image: %s", err) state.Put("error", err) diff --git a/builder/openstack/step_key_pair.go b/builder/openstack/step_key_pair.go index f17d76f35..32d7430ef 100644 --- a/builder/openstack/step_key_pair.go +++ b/builder/openstack/step_key_pair.go @@ -47,8 +47,8 @@ func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - ui.Say("Creating temporary keypair for this instance...") keyName := fmt.Sprintf("packer %s", uuid.TimeOrderedUUID()) + ui.Say(fmt.Sprintf("Creating temporary keypair: %s ...", keyName)) keypair, err := keypairs.Create(computeClient, keypairs.CreateOpts{ Name: keyName, }).Extract() @@ -62,6 +62,8 @@ func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } + ui.Say(fmt.Sprintf("Created temporary keypair: %s", keyName)) + // If we're in debug mode, output the private key to the working // directory. if s.Debug { @@ -120,7 +122,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) { return } - ui.Say("Deleting temporary keypair...") + ui.Say(fmt.Sprintf("Deleting temporary keypair: %s ...", s.keyName)) err = keypairs.Delete(computeClient, s.keyName).ExtractErr() if err != nil { ui.Error(fmt.Sprintf( diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index 77e652dd5..20145929d 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -113,7 +113,7 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) { return } - ui.Say("Terminating the source server...") + ui.Say(fmt.Sprintf("Terminating the source server: %s ...", s.server.ID)) if err := servers.Delete(computeClient, s.server.ID).ExtractErr(); err != nil { ui.Error(fmt.Sprintf("Error terminating server, may still be around: %s", err)) return diff --git a/builder/openstack/step_stop_server.go b/builder/openstack/step_stop_server.go index 298d0bc0a..d04a10f60 100644 --- a/builder/openstack/step_stop_server.go +++ b/builder/openstack/step_stop_server.go @@ -31,14 +31,14 @@ func (s *StepStopServer) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - ui.Say("Stopping server...") + ui.Say(fmt.Sprintf("Stopping server: %s ...", server.ID)) if err := startstop.Stop(client, server.ID).ExtractErr(); err != nil { err = fmt.Errorf("Error stopping server: %s", err) state.Put("error", err) return multistep.ActionHalt } - ui.Message("Waiting for server to stop...") + ui.Message(fmt.Sprintf("Waiting for server to stop: %s ...", server.ID)) stateChange := StateChangeConf{ Pending: []string{"ACTIVE"}, Target: []string{"SHUTOFF", "STOPPED"}, From c8ff4a5230bf5523c3b535f855e3c7d8b031ece1 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 17 Dec 2015 14:52:54 -0700 Subject: [PATCH 23/23] Clarify the need to specify device_name when setting volume_size in Amazon builder. refs #2798 --- website/source/docs/builders/amazon-ebs.html.markdown | 2 +- website/source/docs/builders/amazon-instance.html.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/source/docs/builders/amazon-ebs.html.markdown b/website/source/docs/builders/amazon-ebs.html.markdown index 860040ee7..6ee9adf88 100644 --- a/website/source/docs/builders/amazon-ebs.html.markdown +++ b/website/source/docs/builders/amazon-ebs.html.markdown @@ -69,7 +69,7 @@ builder. device mappings to the AMI. The block device mappings allow for keys: - `device_name` (string) - The device name exposed to the instance (for - example, "/dev/sdh" or "xvdh") + example, "/dev/sdh" or "xvdh"). Required when specifying `volume_size`. - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html) diff --git a/website/source/docs/builders/amazon-instance.html.markdown b/website/source/docs/builders/amazon-instance.html.markdown index 989052b1a..a1530996a 100644 --- a/website/source/docs/builders/amazon-instance.html.markdown +++ b/website/source/docs/builders/amazon-instance.html.markdown @@ -90,7 +90,7 @@ builder. device mappings to the AMI. The block device mappings allow for keys: - `device_name` (string) - The device name exposed to the instance (for - example, "/dev/sdh" or "xvdh") + example, "/dev/sdh" or "xvdh"). Required when specifying `volume_size`. - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html)