diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index cb73142c3..0f53bacaf 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,8 +1,12 @@ +_Please read these instructions before submitting_ + **DELETE THIS TEMPLATE BEFORE SUBMITTING** _Only use Github issues to report bugs or feature requests, see https://www.packer.io/community.html_ +For example, _Timeouts waiting for SSH/WinRM_ are generally not bugs within packer and are better addressed by the mailing list. Ask on the mailing list if you are unsure. + If you are planning to open a pull-request just open the pull-request instead of making an issue first. FOR FEATURES: @@ -19,3 +23,4 @@ Describe the problem and include the following information: Please paste this in a gist https://gist.github.com - The _simplest example template and scripts_ needed to reproduce the bug. Include these in your gist https://gist.github.com + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5fc387f58..e6881a2d3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,8 +4,8 @@ Describe the change you are making here! Please include tests. Check out these examples: -- https://github.com/mitchellh/packer/blob/master/builder/virtualbox/common/ssh_config_test.go#L19-L37 -- https://github.com/mitchellh/packer/blob/master/post-processor/compress/post-processor_test.go#L153-L182 +- https://github.com/hashicorp/packer/blob/master/builder/virtualbox/common/ssh_config_test.go#L19-L37 +- https://github.com/hashicorp/packer/blob/master/post-processor/compress/post-processor_test.go#L153-L182 If your PR resolves any open issue(s), please indicate them like this so they will be closed when your PR is merged: diff --git a/.gitignore b/.gitignore index c3dea6687..6ab3cdfb9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ test/.env *~ *.received.* +*.swp website/.bundle website/vendor @@ -21,3 +22,5 @@ packer-test*.log .idea/ *.iml +Thumbs.db +/packer.exe \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index cac1d8c7d..755c0ef8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,9 @@ sudo: false language: go go: - - 1.7.4 - - 1.8 + - 1.7.x + - 1.8.x + - 1.x install: - make deps @@ -21,5 +22,3 @@ branches: matrix: fast_finish: true - allow_failures: - - go: 1.4.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 74db92757..d8878587c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,557 @@ -## (Unreleased) +## UNRELEASED + + +## 1.2.0 (February 9, 2018) + +### BACKWARDS INCOMPATIBILITIES: +* 3rd party plugins: We have moved internal dependencies, meaning your 3rd + party plugins will no longer compile (however existing builds will still + work fine); the work to fix them is minimal and documented in GH-5810. + [GH-5810] +* builder/amazon: The `ssh_private_ip` option has been removed. Instead, please + use `"ssh_interface": "private"`. A fixer has been written for this, which + can be invoked with `packer fix`. [GH-5876] +* builder/openstack: Extension support has been removed. To use OpenStack + builder with the OpenStack Newton (Oct 2016) or earlier, we recommend you + use Packer v1.1.2 or earlier version. +* core: Affects Windows guests: User variables containing Powershell special + characters no longer need to be escaped.[GH-5376] +* provisioner/file: We've made destination semantics more consistent across the + various communicators. In general, if the destination is a directory, files + will be uploaded into the directory instead of failing. This mirrors the + behavior of `rsync`. There's a chance some users might be depending on the + previous buggy behavior, so it's worth ensuring your configuration is + correct. [GH-5426] +* provisioner/powershell: Regression from v1.1.1 forcing extra escaping of + environment variables in the non-elevated provisioner has been fixed. + [GH-5515] [GH-5872] + +### IMPROVEMENTS: + +* **New builder:** `ncloud` for building server images using the NAVER Cloud + Platform. [GH-5791] +* **New builder:** `oci-classic` for building new custom images for use with + Oracle Cloud Infrastructure Classic Compute. [GH-5819] +* **New builder:** `scaleway` - The Scaleway Packer builder is able to create + new images for use with Scaleway BareMetal and Virtual cloud server. + [GH-4770] +* builder/amazon: Add `kms_key_id` option to block device mappings. [GH-5774] +* builder/amazon: Add `skip_metadata_api_check` option to skip consulting the + amazon metadata service. [GH-5764] +* builder/amazon: Add Paris region (eu-west-3) [GH-5718] +* builder/amazon: Give better error messages if we have trouble during + authentication. [GH-5764] +* builder/amazon: Remove Session Token (STS) from being shown in the log. + [GH-5665] +* builder/amazon: Replace `InstanceStatusOK` check with `InstanceReady`. This + reduces build times universally while still working for all instance types. + [GH-5678] +* builder/amazon: Report which authentication provider we're using. [GH-5764] +* builder/amazon: Timeout early if metadata service can't be reached. [GH-5764] +* builder/amazon: Warn during prepare if we didn't get both an access key and a + secret key when we were expecting one. [GH-5762] +* builder/azure: Add validation for incorrect VHD URLs [GH-5695] +* builder/docker: Remove credentials from being shown in the log. [GH-5666] +* builder/google: Support specifying licenses for images. [GH-5842] +* builder/hyper-v: Allow MAC address specification. [GH-5709] +* builder/hyper-v: New option to use differential disks and Inline disk + creation to improve build time and reduce disk usage [GH-5631] +* builder/qemu: Add Intel HAXM support to QEMU builder [GH-5738] +* builder/triton: Triton RBAC is now supported. [GH-5741] +* builder/triton: Updated triton-go dependencies, allowing better error + handling. [GH-5795] +* builder/vmware-iso: Add support for cdrom and disk adapter types. [GH-3417] +* builder/vmware-iso: Add support for setting network type and network adapter + type. [GH-3417] +* builder/vmware-iso: Add support for usb/serial/parallel ports. [GH-3417] +* builder/vmware-iso: Add support for virtual soundcards. [GH-3417] +* builder/vmware-iso: More reliably retrieve the guest networking + configuration. [GH-3417] +* builder/vmware: Add support for "super" key in `boot_command`. [GH-5681] +* communicator/ssh: Add session-level keep-alives [GH-5830] +* communicator/ssh: Detect dead connections. [GH-4709] +* core: Gracefully clean up resources on SIGTERM. [GH-5318] +* core: Improved error logging in floppy file handling. [GH-5802] +* core: Improved support for downloading and validating a uri containing a + Windows UNC path or a relative file:// scheme. [GH-2906] +* post-processor/amazon-import: Allow user to specify role name in amazon- + import [GH-5817] +* post-processor/docker: Remove credentials from being shown in the log. + [GH-5666] +* post-processor/google-export: Synchronize credential semantics with the + Google builder. [GH-4148] +* post-processor/vagrant: Add vagrant post-processor support for Google + [GH-5732] +* post-processor/vsphere-template: Now accepts artifacts from the vSphere post- + processor. [GH-5380] +* provisioner/amazon: Use Amazon SDK's InstanceRunning waiter instead of + InstanceStatusOK waiter [GH-5773] +* provisioner/ansible: Improve user retrieval. [GH-5758] +* provisioner/chef: Add support for 'trusted_certs_dir' chef-client + configuration option [GH-5790] +* provisioner/chef: Added Policyfile support to chef-client provisioner. + [GH-5831] ### BUG FIXES: -* builder/googlecompute: Correct values for `on_host_maintenance`. [GH-4643] -* builder/amazon: Fix crash in `step_region_copy`. [GH-4642] -* core: show correct step name when debugging. [GH-4672] -* builder/virtualbox: fix `none` communicator by allowing skipping upload of - version file. [GH-4678] -* communicator/ssh: fix nil pointer error. [GH-4690] -* builder/hyper-v: Don't wait for shutdown_command to return. [GH-4691] -* builder/amazon: Fix b/c issue by reporting again the tags we create. - [GH-4704] -* builder/virtualbox: retry removing floppy controller. [GH-4705] -* builder/googlecompute: Use "default" service account. [GH-4749] +* builder/alicloud-ecs: Attach keypair before starting instance in alicloud + builder [GH-5739] +* builder/amazon: Fix tagging support when building in us-gov/china. [GH-5841] +* builder/amazon: NewSession now inherits MaxRetries and other settings. + [GH-5719] +* builder/virtualbox: Fix interpolation ordering so that edge cases around + guest_additions_url are handled correctly [GH-5757] +* builder/virtualbox: Fix regression affecting users running Packer on a + Windows host that kept Packer from finding Virtualbox guest additions if + Packer ran on a different drive from the one where the guest additions were + stored. [GH-5761] +* builder/vmware: Fix case where artifacts might not be cleaned up correctly. + [GH-5835] +* builder/vmware: Fixed file handle leak that may have caused race conditions + in vmware builder [GH-5767] +* communicator/ssh: Add deadline to SSH connection to prevent Packer hangs + after script provisioner reboots vm [GH-4684] +* communicator/winrm: Fix issue copying empty directories. [GH-5763] +* provisioner/ansible-local: Fix support for `--extra-vars` in + `extra_arguments`. [GH-5703] +* provisioner/ansible-remote: Fixes an error where Packer's private key can be + overridden by inherited `ansible_ssh_private_key` options. [GH-5869] +* provisioner/ansible: The "default extra variables" feature added in Packer + v1.0.1 caused the ansible-local provisioner to fail when an --extra-vars + argument was specified in the extra_arguments configuration option; this + has been fixed. [GH-5335] +* provisioner/powershell: Regression from v1.1.1 forcing extra escaping of + environment variables in the non-elevated provisioner has been fixed. + [GH-5515] [GH-5872] -### IMRPOVEMENTS: -* builder/amazon: validate ssh key name/file. [GH-4665] -* builder/amazon: set force_deregister to true on -force. [GH-4649] -* builder/hyper-v: validate output dir in step, not in config. [GH-4645] -* website: fix display on ios devices. [GH-4618] +## 1.1.3 (December 8, 2017) + +### IMPROVEMENTS: + +* builder/alicloud-ecs: Add security token support and set TLS handshake + timeout through environment variable. [GH-5641] +* builder/amazon: Add a new parameter `ssh_interface`. Valid values include + `public_ip`, `private_ip`, `public_dns` or `private_dns`. [GH-5630] +* builder/azure: Add sanity checks for resource group names [GH-5599] +* builder/azure: Allow users to specify an existing resource group to use, + instead of creating a new one for every run. [GH-5548] +* builder/hyper-v: Add support for differencing disk. [GH-5458] +* builder/vmware-iso: Improve logging of network errors. [GH-5456] +* core: Add new `packer_version` template engine. [GH-5619] +* core: Improve logic checking for downloaded ISOs in case where user has + provided more than one URL in `iso_urls` [GH-5632] +* provisioner/ansible-local: Add ability to clean staging directory. [GH-5618] + +### BUG FIXES: + +* builder/amazon: Allow `region` to appear in `ami_regions`. [GH-5660] +* builder/amazon: `C5` instance types now build more reliably. [GH-5678] +* builder/amazon: Correctly set AWS region if given in template along with a + profile. [GH-5676] +* builder/amazon: Prevent `sriov_support` and `ena_support` from being used + with spot instances, which would cause a build failure. [GH-5679] +* builder/hyper-v: Fix interpolation context for user variables in + `boot_command` [GH-5547] +* builder/qemu: Set default disk size to 40960 MB to prevent boot failures. + [GH-5588] +* builder/vmware: Correctly detect Windows boot on vmware workstation. + [GH-5672] +* core: Fix windows path regression when downloading ISOs. [GH-5591] +* provisioner/chef: Fix chef installs on Windows. [GH-5649] + +## 1.1.2 (November 15, 2017) + +### IMPROVEMENTS: + +* builder/amazon: Correctly deregister AMIs when `force_deregister` is set. + [GH-5525] +* builder/digitalocean: Add `ipv6` option to enable on droplet. [GH-5534] +* builder/docker: Add `aws_profile` option to control the aws profile for ECR. + [GH-5470] +* builder/google: Add `clean_image_name` template engine. [GH-5463] +* builder/google: Allow selecting container optimized images. [GH-5576] +* builder/google: Interpolate network and subnetwork values, rather than + relying on an API call that packer may not have permission for. [GH-5343] +* builder/hyper-v: Add `disk_additional_size` option to allow for up to 64 + additional disks. [GH-5491] +* builder/hyper-v: Also disable automatic checkpoints for gen 2 VMs. [GH-5517] +* builder/lxc: Add new `publish_properties` field to set image properties. + [GH-5475] +* builder/lxc: Add three new configuration option categories to LXC builder: + `create_options`, `start_options`, and `attach_options`. [GH-5530] +* builder/triton: Add `source_machine_image_filter` option to select an image + ID based on a variety of parameters. [GH-5538] +* builder/virtualbox-ovf: Error during prepare if source path doesn't exist. + [GH-5573] +* builder/virtualbox-ovf: Retry while removing VM to solve for transient + errors. [GH-5512] +* communicator/ssh: Add socks 5 proxy support. [GH-5439] +* core/iso_config: Support relative paths in checksum file. [GH-5578] +* core: Rewrite vagrantfile code to make cross-platform development easier. + [GH-5539] +* post-processor/docker-push: Add `aws_profile` option to control the aws + profile for ECR. [GH-5470] +* post-processor/vsphere: Properly capture `ovftool` output. [GH-5499] + +### BUG FIXES: + +* builder/amazon: Add a delay option to security group waiter. [GH-5536] +* builder/amazon: Fix regressions relating to spot instances and EBS volumes. + [GH-5495] +* builder/amazon: Set region from profile, if profile is set, rather than being + overridden by metadata. [GH-5562] +* builder/docker: Remove `login_email`, which no longer exists in the docker + client. [GH-5511] +* builder/hyperv: Fix admin check that was causing powershell failures. + [GH-5510] +* builder/oracle: Defaulting of OCI builder region will first check the packer + template and the OCI config file. [GH-5407] +* builder/triton: Fix a bug where partially created images can be reported as + complete. [GH-5566] +* post-processor/vsphere: Use the vm disk path information to re-create the vmx + datastore path. [GH-5567] +* provisioner/windows-restart: Wait for restart no longer endlessly loops if + user specifies a custom restart check command. [GH-5563] + +## 1.1.1 (October 13, 2017) + +### IMPROVEMENTS: + +* **New builder:** `hyperv-vmcx` for building images from existing VMs. + [GH-4944] [GH-5444] +* builder/amazon-instance: Add `.Token` as a variable in the + `BundleUploadCommand` template. [GH-5288] +* builder/amazon: Add `temporary_security_group_source_cidr` option to control + ingress to source instances. [GH-5384] +* builder/amazon: Output AMI Name during prevalidation. [GH-5389] +* builder/amazon: Support template functions in tag keys. [GH-5381] +* builder/amazon: Tag volumes on creation instead of as a separate step. + [GH-5417] +* builder/docker: Add option to set `--user` flag when running `exec`. + [GH-5406] +* builder/docker: Set file owner to container user when uploading. Can be + disabled by setting `fix_upload_owner` to `false`. [GH-5422] +* builder/googlecompute: Support setting labels on the resulting image. + [GH-5356] +* builder/hyper-v: Add `vhd_temp_path` option to control where the VHD resides + while it's being provisioned. [GH-5206] +* builder/hyper-v: Allow vhd or vhdx source images instead of just ISO. + [GH-4944] [GH-5444] +* builder/hyper-v: Disable automatic checkpoints. [GH-5374] +* builder/virtualbox-ovf: Add `keep_registered` option. [GH-5336] +* builder/vmware: Add `disable_vnc` option to prevent VNC connections from + being made. [GH-5436] +* core: Releases will now be built for ppc64le. +* post-processor/vagrant: When building from a builder/hyper-v artifact, link + instead of copy when available. [GH-5207] + + +### BUG FIXES: + +* builder/cloudstack: Fix panic if build is aborted. [GH-5388] +* builder/hyper-v: Respect `enable_dynamic_memory` flag. [GH-5363] +* builder/puppet-masterless: Make sure directories created with sudo are + writable by the packer user. [GH-5351] +* provisioner/chef-solo: Fix issue installing chef-solo on Windows. [GH-5357] +* provisioner/powershell: Fix issue setting environment variables by writing + them to a file, instead of the command line. [GH-5345] +* provisioner/powershell: Fix issue where powershell scripts could hang. + [GH-5082] +* provisioner/powershell: Fix Powershell progress stream leak to stderr for + normal and elevated commands. [GH-5365] +* provisioner/puppet-masterless: Fix bug where `puppet_bin_dir` wasn't being + respected. [GH-5340] +* provisioner/puppet: Fix setting facter vars on Windows. [GH-5341] + + +## 1.1.0 (September 12, 2017) + +### IMPROVEMENTS: + +* builder/alicloud: Update alicloud go sdk and enable multi sites support for + alicloud [GH-5219] +* builder/amazon: Upgrade aws-sdk-go to 1.10.14, add tags at instance run time. + [GH-5196] +* builder/azure: Add object_id to windows_custom_image.json. [GH-5285] +* builder/azure: Add support for storage account for managed images. [GH-5244] +* builder/azure: Update pkcs12 package. [GH-5301] +* builder/cloudstack: Add support for Security Groups. [GH-5175] +* builder/docker: Uploading files and directories now use docker cp. [GH-5273] + [GH-5333] +* builder/googlecompute: Add `labels` option for labeling launched instances. + [GH-5308] +* builder/googlecompute: Add support for accelerator api. [GH-5137] +* builder/profitbricks: added support for Cloud API v4. [GH-5233] +* builder/vmware-esxi: Remote builds now respect `output_directory` [GH-4592] +* builder/vmware: Set artifact ID to `VMName`. [GH-5187] +* core: Build solaris binary by default. [GH-5268] [GH-5248] +* core: Remove LGPL dependencies. [GH-5262] +* provisioner/puppet: Add `guest_os_type` option to add support for Windows. + [GH-5252] +* provisioner/salt-masterless: Also use sudo to clean up if we used sudo to + install. [GH-5240] + +### BACKWARDS INCOMPATIBILITIES: + +* builder/amazon: Changes way that AMI artifacts are printed out after build, + aligning them to builder. Could affect output parsing. [GH-5281] +* builder/amazon: Split `enhanced_networking` into `sriov_support` and + `ena_support` to support finer grained control. Use `packer fix + ` to automatically update your template to use `ena_support` + where previously there was only `enhanced_networking`. Make sure to also + add `sriov_support` if you need that feature, and to ensure `ena_support` + is what you intended to be in your template. [GH-5284] +* builder/cloudstack: Setup temporary SSH keypair; backwards incompatible in + the uncommon case that the source image allowed SSH auth with password but + not with keypair. [GH-5174] +* communicator/ssh: Renamed `ssh_disable_agent` to + `ssh_disable_agent_forwarding`. Need to run fixer on packer configs that + use `ssh_disable_agent`. [GH-5024] +* communicator: Preserve left-sided white-space in remote command output. Make + sure any scripts that parse this output can handle the new whitespace + before upgrading. [GH-5167] +* provisioner/shell: Set default for `ExpectDisconnect` to `false`. If your + script causes the connection to be reset, you should set this to `true` to + prevent errors. [GH-5283] + +### BUG FIXES: + +* builder/amazon: `force_deregister` works in all regions, not just original + region. [GH-5250] +* builder/docker: Directory uploads now use the same semantics as the rest of + the communicators. [GH-5333] +* builder/vmware: Fix timestamp in default VMName. [GH-5274] +* builder/winrm: WinRM now waits to make sure commands can run successfully + before considering itself connected. [GH-5300] +* core: Fix issue where some builders wouldn't respect `-on-error` behavior. + [GH-5297] +* provisioner/windows-restart: The first powershell provisioner after a restart + now works. [GH-5272] + +### FEATURES: + +* **New builder**: Oracle Cloud Infrastructure (OCI) builder for creating + custom images. [GH-4554] +* **New builder:** `lxc` for building lxc images. [GH-3523] +* **New builder:** `lxd` for building lxd images. [GH-3625] +* **New post-processor**: vSphere Template post-processor to be used with + vmware-iso builder enabling user to mark a VM as a template. [GH-5114] + +## 1.0.4 (August 11, 2017) + +### IMPROVEMENTS: + +* builder/alicloud: Increase polling timeout. [GH-5148] +* builder/azure: Add `private_virtual_network_with_public_ip` option to + optionally obtain a public IP. [GH-5222] +* builder/googlecompute: use a more portable method of obtaining zone. + [GH-5192] +* builder/hyperv: Properly interpolate user variables in template. [GH-5184] +* builder/parallels: Remove soon to be removed --vmtype flag in createvm. + [GH-5172] +* contrib: add json files to zsh completion. [GH-5195] + +### BUG FIXES: + +* builder/amazon: Don't delete snapshots we didn't create. [GH-5211] +* builder/amazon: fix builds when using the null communicator. [GH-5217] +* builder/docker: Correctly handle case when uploading an empty directory. + [GH-5234] +* command/push: Don't push variables if they are unspecified. Reverts to + behavior in 1.0.1. [GH-5235] +* command/push: fix handling of symlinks. [GH-5226] +* core: Strip query parameters from ISO URLs when checking against a checksum + file. [GH-5181] +* provisioner/ansible-remote: Fix issue where packer could hang communicating + with ansible-remote. [GH-5146] + +## 1.0.3 (July 17, 2017) + +### IMPROVEMENTS: +* builder/azure: Update to latest Azure SDK, enabling support for managed + disks. [GH-4511] +* builder/cloudstack: Add default cidr_list [ 0.0.0.0/0 ]. [GH-5125] +* builder/cloudstack: Add support for ssh_agent_auth. [GH-5130] +* builder/cloudstack: Add support for using a HTTP server. [GH-5017] +* builder/cloudstack: Allow reading api_url, api_key, and secret_key from env + vars. [GH-5124] +* builder/cloudstack: Make expunge optional and improve logging output. + [GH-5099] +* builder/googlecompute: Allow using URL's for network and subnetwork. + [GH-5035] +* builder/hyperv: Add support for floppy_dirs with hyperv-iso builder. +* builder/hyperv: Add support for override of system %temp% path. +* core: Experimental Android ARM support. [GH-5111] +* post-processor/atlas: Disallow packer push of vagrant.box artifacts to atlas. + [GH-4780] +* postprocessor/atlas: Disallow pushing vagrant.box artifacts now that Vagrant + cloud is live. [GH-4780] + +### BUG FIXES: +* builder/amazon: Fix panic that happens if ami_block_device_mappings is empty. + [GH-5059] +* builder/azure: Write private SSH to file in debug mode. [GH-5070] [GH-5074] +* builder/cloudstack: Properly report back errors. [GH-5103] [GH-5123] +* builder/docker: Fix windows filepath in docker-toolbox call [GH-4887] +* builder/docker: Fix windows filepath in docker-toolbox call. [GH-4887] +* builder/hyperv: Use SID to verify membersip in Admin group, fixing for non- + english users. [GH-5022] +* builder/hyperv: Verify membership in the group Hyper-V Administrators by SID + not name. [GH-5022] +* builder/openstack: Update gophercloud version, fixing builds > 1 hr long. + [GH-5046] +* builder/parallels: Skip missing paths when looking for unnecessary files. + [GH-5058] +* builder/vmware-esxi: Fix VNC port discovery default timeout. [GH-5051] +* communicator/ssh: Add ProvisionerTypes to communicator tests, resolving panic + [GH-5116] +* communicator/ssh: Resolve race condition that sometimes truncates ssh + provisioner stdout [GH-4719] +* post-processor/checksum: Fix interpolation of "output". [GH-5112] +* push: Push vars in packer config, not just those set from command line and in + var-file. [GH-5101] + +## 1.0.2 (June 21, 2017) + +### BUG FIXES: +* communicator/ssh: Fix truncated stdout from remote ssh provisioner. [GH-5050] +* builder/amazon: Fix bugs related to stop instance command. [GH-4719] +* communicator/ssh: Fix ssh connection errors. [GH-5038] +* core: Remove logging that shouldn't be there when running commands. [GH-5042] +* provisioner/shell: Fix bug where scripts were being run under `sh`. [GH-5043] + +### IMPROVEMENTS: + +* provisioner/windows-restart: make it clear that timeouts come from the + provisioner, not winrm. [GH-5040] + +## 1.0.1 (June 19, 2017) + +### IMPROVEMENTS: + +* builder/amazon: Allow amis to be copied to other regions, encrypted with + custom KMS keys. [GH-4948] +* builder/amazon: Allow configuration of api endpoint to support api-compatible + cloud providers. [GH-4896] +* builder/amazon: Fix regex used for ami name validation [GH-4902] +* builder/amazon: Look up vpc from subnet id if no vpc was specified. [GH-4879] +* builder/amazon: Print temporary security group name to the UI. [GH-4997] +* builder/amazon: Support Assume Role with MFA and ECS Task Roles. Also updates + to a newer version of aws-sdk-go. [GH-4996] +* builder/amazon: Use retry logic when creating instance tags. [GH-4876] +* builder/amazon: Validate ami name. [GH-4762] +* builder/azure: Add build output to artifact. [GH-4953] +* builder/azure: Use disk URI as artifact ID. [GH-4981] +* builder/digitalocean: Added support for monitoring. [GH-4782] +* builder/digitalocean: Support for copying snapshot to other regions. + [GH-4893] +* builder/hyper-v: Remove the check for administrator rights when sending key + strokes to Hyper-V. [GH-4687] # builder/openstack: Fix private key error + message to match documentation [GH-4898] +* builder/null: Support SSH agent auth [GH-4956] * builder/openstack: Add ssh agent support. [GH-4655] +* builder/openstack: Support client x509 certificates. [GH-4921] * builder/parallels-iso: Configuration of disk type, plain or expanding. [GH-4621] +* builder/triton: An SSH agent can be used to authenticate requests, making + `triton_key_material` optional. [GH-4838] +* builder/triton: If no source machine networks are specified, instances are + started on the default public and internal networks. [GH-4838] +* builder/virtualbox: Add sata port count configuration option. [GH-4699] +* builder/virtualbox: Don't add port forwarding when using "none" communicator. + [GH-4960] +* builder/vmware: Add option to remove interfaces from the vmx. [GH-4927] +* builder/vmware: Properly remove mounted CDs on OS X. [GH-4810] +* builder/vmware: VNC probe timeout is configurable. [GH-4919] +* command/push: add `-sensitive` flag to mark pushed vars are sensitive. + [GH-4970] +* command/push: Vagrant support in Terraform Enterprise is deprecated. + [GH-4950] +* communicator/ssh: Add ssh agent support for bastion connections. [GH-4940] +* communicator/winrm: Add NTLM authentication support. [GH-4979] +* communicator/winrm: Add support for file downloads. [GH-4748] +* core: add telemetry for better product support. [GH-5015] +* core: Build binaries for arm64 [GH-4892] +* post-processor/amazon-import: Add support for `license_type`. [GH-4634] +* post-processor/vagrant-cloud: Get vagrant cloud token from environment. + [GH-4982] +* provisioner/ansible-local: Add extra-vars `packer_build_name`, + `packer_builder_type`, and `packer_http_addr`. [GH-4821] +* provisioner/ansible: Add `inventory_directory` option to control where to + place the generated inventory file. [GH-4760] +* provisioner/ansible: Add `skip_version_check` flag for when ansible will be + installed from a prior provisioner. [GH-4983] +* provisioner/ansible: Add extra-vars `packer_build_name` and + `packer_builder_type`. [GH-4821] +* provisioner/chef-solo: Add option to select Chef version. [GH-4791] +* provisioner/salt: Add salt bin directory configuration. [GH-5009] +* provisioner/salt: Add support for grains. [GH-4961] +* provisioner/shell: Use `env` to set environment variables to support freebsd + out of the box. [GH-4909] +* website/docs: Clarify language, improve formatting. [GH-4866] +* website/docs: Update docker metadata fields that can be changed. [GH-4867] + + +### BUG FIXES: + +* builder/amazon-ebssurrogate: Use ami device settings when creating the AMI. + [GH-4972] +* builder/amazon: don't try to delete extra volumes during clean up. [GH-4930] +* builder/amazon: fix `force_delete_snapshot` when the launch instance has + extra volumes. [GH-4931] +* builder/amazon: Only delete temporary key if we created one. [GH-4850] +* builder/azure: Replace calls to panic with error returns. [GH-4846] +* communicator/winrm: Use KeepAlive to keep long-running connections open. + [GH-4952] +* core: Correctly reject config files which have junk after valid json. + [GH-4906] +* post-processor/checksum: fix crash when invalid checksum is used. [GH-4812] +* post-processor/vagrant-cloud: don't read files to upload in to memory first. + [GH-5005] +* post-processor/vagrant-cloud: only upload once under normal conditions. + [GH-5008] +* provisioner/ansible-local: Correctly set the default staging directory under + Windows. [GH-4792] + +### FEATURES: + +* **New builder:** `alicloud-ecs` for building Alicloud ECS images. [GH-4619] + + +## 1.0.0 (April 4, 2017) + +### BUG FIXES: + +* builder/amazon: Fix b/c issue by reporting again the tags we create. + [GH-4704] +* builder/amazon: Fix crash in `step_region_copy`. [GH-4642] +* builder/googlecompute: Correct values for `on_host_maintenance`. [GH-4643] +* builder/googlecompute: Use "default" service account. [GH-4749] +* builder/hyper-v: Don't wait for shutdown_command to return. [GH-4691] +* builder/virtualbox: fix `none` communicator by allowing skipping upload of + version file. [GH-4678] +* builder/virtualbox: retry removing floppy controller. [GH-4705] +* communicator/ssh: don't return error if we can't close connection. [GH-4741] +* communicator/ssh: fix nil pointer error. [GH-4690] +* core: fix version number +* core: Invoking packer `--help` or `--version` now exits with status 0. + [GH-4723] +* core: show correct step name when debugging. [GH-4672] +* communicator/winrm: Directory uploads behave more like scp. [GH-4438] + +### IMPROVEMENTS: + +* builder/amazon-chroot: Ability to give an empty list in `copy_files` to + prevent the default `/etc/resolv.conf` file from being copied. If + `copy_files` isn't given at all, the default behavior remains. [GH-4708] +* builder/amazon: set force_deregister to true on -force. [GH-4649] +* builder/amazon: validate ssh key name/file. [GH-4665] * builder/ansible: Clearer error message when we have problems getting the ansible version. [GH-4694] -* builder/amazon-chroot: Ability to give an empty list in `copy_files` to - prevent the default `/etc/resolv.conf` file from being copied. If `copy_files` - isn't given at all, the default behavior remains. [GH-4708] +* builder/hyper-v: validate output dir in step, not in config. [GH-4645] +* More diligently try to complete azure-setup.sh. [GH-4752] +* website: fix display on ios devices. [GH-4618] ## 0.12.3 (March 1, 2017) @@ -41,42 +565,43 @@ ### IMPROVEMENTS: +* builder/amazon-chroot: support encrypted boot volume. [GH-4584] * builder/amazon: Add BuildRegion and SourceAMI template variables. [GH-4399] * builder/amazon: Change EC2 Windows password timeout to 20 minutes. [GH-4590] -* builder/amazon-chroot: support encrypted boot volume. [GH-4584] -* builder/docker: create export dir if needed. [GH-4439] -* builder/googlecompute: Add `on_host_maintenance` option. [GH-4544] -* builder/openstack: add reuse_ips option to try to re-use existing IPs. [GH-4564] -* communicator/docker: preserve file mode. [GH-4443] -* communicator/winrm: support ProxyFromEnvironment. [GH-4463] -* core: make VNC links clickable in terminal. [GH-4497] [GH-4498] -* post-processor/amazon-import: support AMI attributes on import [GH-4216] -* communicator/ssh: Use SSH agent when enabled for bastion step. [GH-4598] * builder/amazon: enable ena when `enhanced_networking` is set. [GH-4578] -* builder/vmware-esxi: try for longer to connect to vnc port. [GH-4480] - [GH-4610] -* core: don't show ui color if we're not colorized. [GH-4525] -* builder/vmware: don't cache ip address so we know if it changes. [GH-4532] -* builder/vmware: allow extra options for ovftool. [GH-4536] -* docs: add community page. [GH-4550] -* post-processor/docker-import: print stderr on docker import failure. - [GH-4529] * builder/azure:: add two new config variables for temp_compute_name and temp_resource_group_name. [GH-4468] +* builder/docker: create export dir if needed. [GH-4439] +* builder/googlecompute: Add `on_host_maintenance` option. [GH-4544] +* builder/openstack: add reuse_ips option to try to re-use existing IPs. + [GH-4564] +* builder/vmware-esxi: try for longer to connect to vnc port. [GH-4480] + [GH-4610] +* builder/vmware: allow extra options for ovftool. [GH-4536] +* builder/vmware: don't cache ip address so we know if it changes. [GH-4532] +* communicator/docker: preserve file mode. [GH-4443] +* communicator/ssh: Use SSH agent when enabled for bastion step. [GH-4598] +* communicator/winrm: support ProxyFromEnvironment. [GH-4463] +* core: don't show ui color if we're not colorized. [GH-4525] +* core: make VNC links clickable in terminal. [GH-4497] [GH-4498] +* docs: add community page. [GH-4550] +* post-processor/amazon-import: support AMI attributes on import [GH-4216] +* post-processor/docker-import: print stderr on docker import failure. + [GH-4529] ### BUG FIXES: -* builder/amazon: Fix ssh agent authentication. [GH-4597] * builder/amazon-ebsvolume: Fix interpolation of block_device. [GH-4464] +* builder/amazon: Fix ssh agent authentication. [GH-4597] +* builder/docker: Don't force tag if using a docker version that doesn't + support it. [GH-4560] * builder/googlecompute: fix bug when creating image from custom image_family. [GH-4518] * builder/virtualbox: remove guest additions before saving image. [GH-4496] * core: always check for an error first when walking a path. [GH-4467] -* builder/docker: Don't force tag if using a docker version that doesn't - support it. [GH-4560] +* core: update crypto/ssh lib to fix large file uploads. [GH-4546] * provisioner/chef-client: only upload knife config if we're cleaning. [GH-4534] -* core: update crypto/ssh lib to fix large file uploads. [GH-4546] ## 0.12.2 (January 20, 2017) @@ -89,12 +614,13 @@ * builder/hyperv-iso: add `iso_target_extension` option. [GH-4294] * builder/openstack: Add support for instance metadata. [GH-4361] -* builder/openstack: Attempt to use existing floating IPs before allocating - a new one. [GH-4357] +* builder/openstack: Attempt to use existing floating IPs before allocating a + new one. [GH-4357] * builder/parallels-iso: add `iso_target_extension` option. [GH-4294] * builder/qemu: add `iso_target_extension` option. [GH-4294] * builder/qemu: add `use_default_display` option for osx compatibility. [GH-4293] +* builder/qemu: Detect input disk image format during copy/convert. [GH-4343] * builder/virtualbox-iso: add `iso_target_extension` option. [GH-4294] * builder/virtualbox: add `skip_export` option to skip exporting the VM after build completes. [GH-4339] @@ -106,23 +632,22 @@ * builder/vmware: Try to use `ip address` to find host IP. [GH-4411] * common/step_http\_server: set `PACKER_HTTP_ADDR` env var for accessing http server from inside builder. [GH-4409] -* provisioner/powershell: Allow equals sign in value of environment - variables. [GH-4328] +* provisioner/powershell: Allow equals sign in value of environment variables. + [GH-4328] * provisioner/puppet-server: Add default facts. [GH-4286] -* builder/qemu: Detect input disk image format during copy/convert. [GH-4343] ### BUG FIXES: * builder/amazon-chroot: Panic in AMI region copy step. [GH-4341] * builder/amazon: Crashes when new EBS vols are used. [GH-4308] * builder/amazon: Fix crash in amazon-instance. [GH-4372] +* builder/amazon: fix run volume tagging [GH-4420] +* builder/amazon: fix when using non-existant security\_group\_id. [GH-4425] * builder/amazon: Properly error if we don't have the ec2:DescribeSecurityGroups permission. [GH-4304] * builder/amazon: Properly wait for security group to exist. [GH-4369] -* builder/amazon: fix run volume tagging [GH-4420] -* builder/amazon: fix when using non-existant security\_group\_id. [GH-4425] -* builder/docker: Fix crash when performing log in to ECR with an invalid - URL. [GH-4385] +* builder/docker: Fix crash when performing log in to ECR with an invalid URL. + [GH-4385] * builder/openstack: fix for finding resource by ID. [GH-4301] * builder/qemu: Explicitly set WinRMPort for StepConnect. [GH-4321] * builder/virtualbox: Explicitly set WinRMPort for StepConnect. [GH-4321] @@ -133,8 +658,7 @@ * command/push: Don't interpolate variables when pushing. [GH-4389] * common/step_http_server: make port range inclusive. [GH-4398] * communicator/winrm: update winrm client, resolving `MaxMemoryPerShellMB` - errors and properly error logging instead of panicking. [GH-4412] - [GH-4424] + errors and properly error logging instead of panicking. [GH-4412] [GH-4424] * provider/windows-shell: Allows equals sign in env var value. [GH-4423] ## 0.12.1 (December 15, 2016) @@ -146,9 +670,9 @@ "packer fix template.json" to migrate a template. [GH-4285] * builder/openstack: No long supports the `api_key` option for rackspace. [GH-4283] -* post-processor/manifest: Changed `filename` field to be `output`, to be - more consistent with other post-processors. `packer fix` will fix this - for you. [GH-4192] +* post-processor/manifest: Changed `filename` field to be `output`, to be more + consistent with other post-processors. `packer fix` will fix this for you. + [GH-4192] * post-processor/shell-local: Now runs per-builder instead of per-file. The filename is no longer passed in as an argument to the script, but instead needs to be gleaned from the manifest post-processor. [GH-4189] diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..216cce578 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,28 @@ +* @hashicorp/packer + +# builders + +/builder/alicloud/ dongxiao.zzh@alibaba-inc.com +/builder/amazon/ebssurrogate/ @jen20 +/builder/amazon/ebsvolume/ @jen20 +/builder/azure/ @boumenot +/builder/hyperv/ @taliesins +/builder/lxc/ @ChrisLundquist +/builder/lxd/ @ChrisLundquist +/builder/oneandone/ @jasmingacic +/builder/oracle/ @prydie @owainlewis +/builder/profitbricks/ @jasmingacic +/builder/triton/ @jen20 @sean- +/builder/ncloud/ @YuSungDuk +/builder/scaleway/ @dimtion @edouardb + +# provisioners + +/provisioner/ansible/ @bhcleek +/provisioner/converge/ @stevendborrelli + +# post-processors +/post-processor/alicloud-import/ dongxiao.zzh@alibaba-inc.com +/post-processor/checksum/ v.tolstov@selfip.ru +/post-processor/googlecompute-export/ crunkleton@google.com +/post-processor/vsphere-template/ nelson@bennu.cl diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 131c27256..2ae5b39fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,46 +1,46 @@ # Contributing to Packer -**First:** if you're unsure or afraid of _anything_, just ask -or submit the issue or pull request anyways. You won't be yelled at for -giving your best effort. The worst that can happen is that you'll be -politely asked to change something. We appreciate any sort of contributions, -and don't want a wall of rules to get in the way of that. +**First:** if you're unsure or afraid of _anything_, just ask or submit the +issue or pull request anyways. You won't be yelled at for giving your best +effort. The worst that can happen is that you'll be politely asked to change +something. We appreciate any sort of contributions, and don't want a wall of +rules to get in the way of that. -However, for those individuals who want a bit more guidance on the -best way to contribute to the project, read on. This document will cover -what we're looking for. By addressing all the points we're looking for, -it raises the chances we can quickly merge or address your contributions. +However, for those individuals who want a bit more guidance on the best way to +contribute to the project, read on. This document will cover what we're looking +for. By addressing all the points we're looking for, it raises the chances we +can quickly merge or address your contributions. ## Issues ### Reporting an Issue -* Make sure you test against the latest released version. It is possible - we already fixed the bug you're experiencing. +* Make sure you test against the latest released version. It is possible we + already fixed the bug you're experiencing. -* Run the command with debug ouput with the environment variable - `PACKER_LOG`. For example: `PACKER_LOG=1 packer build template.json`. Take - the *entire* output and create a [gist](https://gist.github.com) for linking - to in your issue. Packer should strip sensitive keys from the output, - but take a look through just in case. +* Run the command with debug output with the environment variable `PACKER_LOG`. + For example: `PACKER_LOG=1 packer build template.json`. Take the _entire_ + output and create a [gist](https://gist.github.com) for linking to in your + issue. Packer should strip sensitive keys from the output, but take a look + through just in case. -* Provide a reproducible test case. If a contributor can't reproduce an - issue, then it dramatically lowers the chances it'll get fixed. And in - some cases, the issue will eventually be closed. +* Provide a reproducible test case. If a contributor can't reproduce an issue, + then it dramatically lowers the chances it'll get fixed. And in some cases, + the issue will eventually be closed. -* Respond promptly to any questions made by the Packer team to your issue. - Stale issues will be closed. +* Respond promptly to any questions made by the Packer team to your issue. Stale + issues will be closed. ### Issue Lifecycle 1. The issue is reported. 2. The issue is verified and categorized by a Packer collaborator. - Categorization is done via tags. For example, bugs are marked as "bugs" - and easy fixes are marked as "easy". + Categorization is done via tags. For example, bugs are marked as "bugs" and + easy fixes are marked as "easy". -3. Unless it is critical, the issue is left for a period of time (sometimes - many weeks), giving outside contributors a chance to address the issue. +3. Unless it is critical, the issue is left for a period of time (sometimes many + weeks), giving outside contributors a chance to address the issue. 4. The issue is addressed in a pull request or commit. The issue will be referenced in the commit message so that the code that fixes it is clearly @@ -50,86 +50,108 @@ it raises the chances we can quickly merge or address your contributions. ## Setting up Go to work on Packer -If you have never worked with Go before, you will have to complete the -following steps in order to be able to compile and test Packer. These instructions target POSIX-like environments (Mac OS X, Linux, Cygwin, etc.) so you may need to adjust them for Windows or other shells. +If you have never worked with Go before, you will have to complete the following +steps in order to be able to compile and test Packer. These instructions target +POSIX-like environments (Mac OS X, Linux, Cygwin, etc.) so you may need to +adjust them for Windows or other shells. -1. [Download](https://golang.org/dl) and install Go. The instructions below - are for go 1.6. Earlier versions of Go are no longer supported. +1. [Download](https://golang.org/dl) and install Go. The instructions below are + for go 1.7. Earlier versions of Go are no longer supported. 2. Set and export the `GOPATH` environment variable and update your `PATH`. For - example, you can add to your `.bash_profile`. + example, you can add the following to your `.bash_profile` (or comparable + shell startup scripts): - ``` - export GOPATH=$HOME/go - export PATH=$PATH:$GOPATH/bin - ``` +``` +export GOPATH=$HOME/go +export PATH=$PATH:$GOPATH/bin +``` -3. Download the Packer source (and its dependencies) by running `go get - github.com/mitchellh/packer`. This will download the Packer source to - `$GOPATH/src/github.com/mitchellh/packer`. +3. Download the Packer source (and its dependencies) by running + `go get github.com/hashicorp/packer`. This will download the Packer source to + `$GOPATH/src/github.com/hashicorp/packer`. -4. When working on packer `cd $GOPATH/src/github.com/mitchellh/packer` so you - can run `make` and easily access other files. Run `make help` to get +4. When working on Packer, first `cd $GOPATH/src/github.com/hashicorp/packer` + so you can run `make` and easily access other files. Run `make help` to get information about make targets. 5. Make your changes to the Packer source. You can run `make` in - `$GOPATH/src/github.com/mitchellh/packer` to run tests and build the packer + `$GOPATH/src/github.com/hashicorp/packer` to run tests and build the Packer binary. Any compilation errors will be shown when the binaries are - rebuilding. If you don't have `make` you can simply run `go build -o bin/packer .` from the project root. + rebuilding. If you don't have `make` you can simply run + `go build -o bin/packer .` from the project root. -6. After running building packer successfully, use - `$GOPATH/src/github.com/mitchellh/packer/bin/packer` to build a machine and - verify your changes work. For instance: `$GOPATH/src/github.com/mitchellh/packer/bin/packer build template.json`. +6. After running building Packer successfully, use + `$GOPATH/src/github.com/hashicorp/packer/bin/packer` to build a machine and + verify your changes work. For instance: + `$GOPATH/src/github.com/hashicorp/packer/bin/packer build template.json`. -7. If everything works well and the tests pass, run `go fmt` on your code - before submitting a pull-request. +7. If everything works well and the tests pass, run `go fmt` on your code before + submitting a pull-request. ### Opening an Pull Request -When you are ready to open a pull-request, you will need to [fork packer](https://github.com/mitchellh/packer#fork-destination-box), push your changes to your fork, and then open a pull-request. +When you are ready to open a pull-request, you will need to +[fork Packer](https://github.com/hashicorp/packer#fork-destination-box), push +your changes to your fork, and then open a pull-request. -For example, my github username is `cbednarski` so I would do the following: +For example, my github username is `cbednarski`, so I would do the following: - git checkout -b f-my-feature - // develop a patch - git push https://github.com/cbednarski/packer f-my-feature +``` +git checkout -b f-my-feature +# Develop a patch. +git push https://github.com/cbednarski/Packer f-my-feature +``` From there, open your fork in your browser to open a new pull-request. -**Note** Go infers package names from their filepaths. This means `go build` will break if you `git clone` your fork instead of using `go get` on the main packer project. +**Note:** Go infers package names from their file paths. This means `go build` +will break if you `git clone` your fork instead of using `go get` on the main +Packer project. ### Tips for Working on Packer #### Working on forks -The easiest way to work on a fork is to set it as a remote of the packer project. After following the steps in "Setting up Go to work on Packer": +The easiest way to work on a fork is to set it as a remote of the Packer +project. After following the steps in "Setting up Go to work on Packer": -1. Navigate to $GOPATH/src/github.com/mitchellh/packer -2. Add the remote `git remote add `. For example `git remote add mwhooker https://github.com/mwhooker/packer.git`. +1. Navigate to `$GOPATH/src/github.com/hashicorp/packer` +2. Add the remote by running + `git remote add `. For example: + `git remote add mwhooker https://github.com/mwhooker/packer.git`. 3. Checkout a feature branch: `git checkout -b new-feature` 4. Make changes -5. (Optional) Push your changes to the fork: `git push -u new-feature` +5. (Optional) Push your changes to the fork: + `git push -u new-feature` -This way you can push to your fork to create a PR, but the code on disk still lives in the spot where the go cli tools are expecting to find it. +This way you can push to your fork to create a PR, but the code on disk still +lives in the spot where the go cli tools are expecting to find it. #### Govendor -If you are submitting a change that requires new or updated dependencies, please include them in `vendor/vendor.json` and in the `vendor/` folder. This helps everything get tested properly in CI. +If you are submitting a change that requires new or updated dependencies, please +include them in `vendor/vendor.json` and in the `vendor/` folder. This helps +everything get tested properly in CI. -Note that you will need to use [govendor](https://github.com/kardianos/govendor) to do this. This step is recommended but not required; if you don't use govendor please indicate in your PR which dependencies have changed and to what versions. +Note that you will need to use [govendor](https://github.com/kardianos/govendor) +to do this. This step is recommended but not required; if you don't use govendor +please indicate in your PR which dependencies have changed and to what versions. Use `govendor fetch ` to add dependencies to the project. See -[govendor quick -start](https://github.com/kardianos/govendor#quick-start-also-see-the-faq) for -examples. +[govendor quick start](https://github.com/kardianos/govendor#quick-start-also-see-the-faq) +for examples. -Please only apply the minimal vendor changes to get your PR to work. Packer does not attempt to track the latest version for each dependency. +Please only apply the minimal vendor changes to get your PR to work. Packer does +not attempt to track the latest version for each dependency. #### Running Unit Tests You can run tests for individual packages using commands like this: - $ make test TEST=./builder/amazon/... +``` +make test TEST=./builder/amazon/... +``` #### Running Acceptance Tests @@ -137,21 +159,34 @@ Packer has [acceptance tests](https://en.wikipedia.org/wiki/Acceptance_testing) for various builders. These typically require an API key (AWS, GCE), or additional software to be installed on your computer (VirtualBox, VMware). -If you're working on a new builder or builder feature and want verify it is functioning (and also hasn't broken anything else), we recommend running the +If you're working on a new builder or builder feature and want verify it is +functioning (and also hasn't broken anything else), we recommend running the acceptance tests. -**Warning:** The acceptance tests create/destroy/modify *real resources*, which -may incur costs for real money. In the presence of a bug, it is possible that resources may be left behind, which can cost money even though you were not using them. We recommend running tests in an account used only for that purpose so it is easy to see if there are any dangling resources, and so production resources are not accidentally destroyed or overwritten during testing. +**Warning:** The acceptance tests create/destroy/modify _real resources_, which +may incur costs for real money. In the presence of a bug, it is possible that +resources may be left behind, which can cost money even though you were not +using them. We recommend running tests in an account used only for that purpose +so it is easy to see if there are any dangling resources, and so production +resources are not accidentally destroyed or overwritten during testing. To run the acceptance tests, invoke `make testacc`: - $ make testacc TEST=./builder/amazon/ebs - ... +``` +make testacc TEST=./builder/amazon/ebs +... +``` The `TEST` variable lets you narrow the scope of the acceptance tests to a -specific package / folder. The `TESTARGS` variable is recommended to filter -down to a specific resource to test, since testing all of them at once can -sometimes take a very long time. +specific package / folder. The `TESTARGS` variable is recommended to filter down +to a specific resource to test, since testing all of them at once can sometimes +take a very long time. + +To run only a specific test, use the `-run` argument: + +``` +make testacc TEST=./builder/amazon/ebs TESTARGS="-run TestBuilderAcc_forceDeleteSnapshot" +``` Acceptance tests typically require other environment variables to be set for things such as API tokens and keys. Each test should error and tell you which diff --git a/Makefile b/Makefile index 9fbaab871..3a68f0ba5 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,17 @@ GITSHA:=$(shell git rev-parse HEAD) # Get the current local branch name from git (if we can, this may be blank) GITBRANCH:=$(shell git symbolic-ref --short HEAD 2>/dev/null) GOFMT_FILES?=$$(find . -not -path "./vendor/*" -name "*.go") +GOOS=$(shell go env GOOS) +GOARCH=$(shell go env GOARCH) +GOPATH=$(shell go env GOPATH) + +# Get the git commit +GIT_DIRTY=$(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true) +GIT_COMMIT=$(shell git rev-parse --short HEAD) +GIT_IMPORT=github.com/hashicorp/packer/version +GOLDFLAGS=-X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY) + +export GOLDFLAGS default: deps generate test dev @@ -13,32 +24,37 @@ ci: deps test release: deps test releasebin package ## Build a release build bin: deps ## Build debug/test build + @go get github.com/mitchellh/gox @echo "WARN: 'make bin' is for debug / test builds only. Use 'make release' for release builds." - @GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh" + @sh -c "$(CURDIR)/scripts/build.sh" releasebin: deps + @go get github.com/mitchellh/gox @grep 'const VersionPrerelease = "dev"' version/version.go > /dev/null ; if [ $$? -eq 0 ]; then \ echo "ERROR: You must remove prerelease tags from version/version.go prior to release."; \ exit 1; \ fi - @GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh" + @sh -c "$(CURDIR)/scripts/build.sh" package: $(if $(VERSION),,@echo 'VERSION= needed to release; Use make package skip compilation'; exit 1) @sh -c "$(CURDIR)/scripts/dist.sh $(VERSION)" deps: - go get github.com/mitchellh/gox - go get golang.org/x/tools/cmd/stringer - go get github.com/kardianos/govendor - govendor sync + @go get golang.org/x/tools/cmd/stringer + @go get github.com/kardianos/govendor + @govendor sync dev: deps ## Build and install a development build @grep 'const VersionPrerelease = ""' version/version.go > /dev/null ; if [ $$? -eq 0 ]; then \ echo "ERROR: You must add prerelease tags to version/version.go prior to making a dev build."; \ exit 1; \ fi - @PACKER_DEV=1 GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh" + @mkdir -p pkg/$(GOOS)_$(GOARCH) + @mkdir -p bin + @go install -ldflags '$(GOLDFLAGS)' + @cp $(GOPATH)/bin/packer bin/packer + @cp $(GOPATH)/bin/packer pkg/$(GOOS)_$(GOARCH) fmt: ## Format Go code @gofmt -w -s $(GOFMT_FILES) @@ -46,6 +62,9 @@ fmt: ## Format Go code fmt-check: ## Check go code formatting $(CURDIR)/scripts/gofmtcheck.sh $(GOFMT_FILES) +fmt-docs: + @find ./website/source/docs -name "*.md" -exec pandoc --wrap auto --columns 79 --atx-headers -s -f "markdown_github+yaml_metadata_block" -t "markdown_github+yaml_metadata_block" {} -o {} \; + # Install js-beautify with npm install -g js-beautify fmt-examples: find examples -name *.json | xargs js-beautify -r -s 2 -n -eol "\n" @@ -72,11 +91,9 @@ testrace: deps ## Test for race conditions @go test -race $(TEST) $(TESTARGS) -timeout=2m updatedeps: - go get -u github.com/mitchellh/gox - go get -u golang.org/x/tools/cmd/stringer @echo "INFO: Packer deps are managed by govendor. See CONTRIBUTING.md" help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: bin checkversion ci default deps fmt fmt-examples generate releasebin test testacc testrace updatedeps +.PHONY: bin checkversion ci default deps fmt fmt-docs fmt-examples generate releasebin test testacc testrace updatedeps diff --git a/README.md b/README.md index 6c767ce49..1c30fd877 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ [![GoDoc][godoc-badge]][godoc] [![GoReportCard][report-badge]][report] -[travis-badge]: https://travis-ci.org/mitchellh/packer.svg?branch=master -[travis]: https://travis-ci.org/mitchellh/packer -[appveyor-badge]: https://ci.appveyor.com/api/projects/status/github/mitchellh/packer?branch=master&svg=true +[travis-badge]: https://travis-ci.org/hashicorp/packer.svg?branch=master +[travis]: https://travis-ci.org/hashicorp/packer +[appveyor-badge]: https://ci.appveyor.com/api/projects/status/miavlgnp989e5obc/branch/master?svg=true [appveyor]: https://ci.appveyor.com/project/hashicorp/packer [godoc-badge]: https://godoc.org/github.com/mitchellh/packer?status.svg [godoc]: https://godoc.org/github.com/mitchellh/packer @@ -16,7 +16,7 @@ * Website: https://www.packer.io * IRC: `#packer-tool` on Freenode -* Mailing list: [Google Groups](http://groups.google.com/group/packer-tool) +* Mailing list: [Google Groups](https://groups.google.com/forum/#!forum/packer-tool) Packer is a tool for building identical machine images for multiple platforms from a single source configuration. @@ -34,9 +34,11 @@ comes out of the box with support for the following platforms: * Hyper-V * 1&1 * OpenStack +* Oracle Cloud Infrastructure * Parallels * ProfitBricks * QEMU. Both KVM and Xen images. +* Scaleway * Triton (Joyent Public Cloud) * VMware * VirtualBox @@ -49,16 +51,16 @@ The images that Packer creates can easily be turned into ## Quick Start Download and install packages and dependencies ``` -go get github.com/mitchellh/packer +go get github.com/hashicorp/packer ``` **Note:** There is a great -[introduction and getting started guide](http://www.packer.io/intro) +[introduction and getting started guide](https://www.packer.io/intro) for those with a bit more patience. Otherwise, the quick start below will get you up and running quickly, at the sacrifice of not explaining some key points. -First, [download a pre-built Packer binary](http://www.packer.io/downloads.html) +First, [download a pre-built Packer binary](https://www.packer.io/downloads.html) for your operating system or [compile Packer yourself](CONTRIBUTING.md#setting-up-go-to-work-on-packer). After Packer is installed, create your first template, which tells Packer @@ -103,8 +105,8 @@ they're run, etc. is up to you. Comprehensive documentation is viewable on the Packer website: -http://www.packer.io/docs +https://www.packer.io/docs ## Developing Packer -See [CONTRIBUTING.md](https://github.com/mitchellh/packer/blob/master/CONTRIBUTING.md) for best practices and instructions on setting up your development environment to work on Packer. +See [CONTRIBUTING.md](https://github.com/hashicorp/packer/blob/master/CONTRIBUTING.md) for best practices and instructions on setting up your development environment to work on Packer. diff --git a/Vagrantfile b/Vagrantfile index b61b3d209..dd6370f04 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,50 +1,84 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -$script = <` tags to enclose any commands +that you would normally run in a Command Prompt window. See +[Running Commands on Your Windows Instance at Launch]( +http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html) +for more info about what's going on behind the scenes here. + +```powershell + +# Set administrator password +net user Administrator SuperS3cr3t! +wmic useraccount where "name='Administrator'" set PasswordExpires=FALSE + +# First, make sure WinRM can't be connected to +netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=block + +# Delete any existing WinRM listeners +winrm delete winrm/config/listener?Address=*+Transport=HTTP 2>$Null +winrm delete winrm/config/listener?Address=*+Transport=HTTPS 2>$Null + +# Create a new WinRM listener and configure +winrm create winrm/config/listener?Address=*+Transport=HTTP +winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}' +winrm set winrm/config '@{MaxTimeoutms="7200000"}' +winrm set winrm/config/service '@{AllowUnencrypted="true"}' +winrm set winrm/config/service '@{MaxConcurrentOperationsPerUser="12000"}' +winrm set winrm/config/service/auth '@{Basic="true"}' +winrm set winrm/config/client/auth '@{Basic="true"}' + +# Configure UAC to allow privilege elevation in remote shells +$Key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' +$Setting = 'LocalAccountTokenFilterPolicy' +Set-ItemProperty -Path $Key -Name $Setting -Value 1 -Force + +# Configure and restart the WinRM Service; Enable the required firewall exception +Stop-Service -Name WinRM +Set-Service -Name WinRM -StartupType Automatic +netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new action=allow localip=any remoteip=any +Start-Service -Name WinRM + +``` + +Save the above code in a file named `bootstrap_win.txt`. + +-> **A quick aside/warning:**
+Windows administrators in the know might be wondering why we haven't simply +used a `winrm quickconfig -q` command in the script above, as this would +*automatically* set up all of the required elements necessary for connecting +over WinRM. Why all the extra effort to configure things manually?
+Well, long and short, use of the `winrm quickconfig -q` command can sometimes +cause the Packer build to fail shortly after the WinRM connection is +established. How?
+1. Among other things, as well as setting up the listener for WinRM, the +quickconfig command also configures the firewall to allow management messages +to be sent over HTTP.
+2. This undoes the previous command in the script that configured the +firewall to prevent this access.
+3. The upshot is that the system is configured and ready to accept WinRM +connections earlier than intended.
+4. If Packer establishes its WinRM connection immediately after execution of +the 'winrm quickconfig -q' command, the later commands within the script that +restart the WinRM service will unceremoniously pull the rug out from under +the connection.
+5. While Packer does *a lot* to ensure the stability of its connection in to +your instance, this sort of abuse can prove to be too much and *may* cause +your Packer build to stall irrecoverably or fail! + +Now we've got the business of getting Packer connected to our instance +taken care of, let's get on with the *real* reason we're doing all this, +which is actually configuring and customizing the instance. Again, we do this +with [Provisioners](/docs/provisioners/index.html). + +The example config below shows the two different ways of using the [PowerShell +provisioner](/docs/provisioners/powershell.html): `inline` and `script`. +The first example, `inline`, allows you to provide short snippets of code, and +will create the script file for you. The second example allows you to run more +complex code by providing the path to a script to run on the guest VM. + +Here's an example of a `sample_script.ps1` that will work with the environment +variables we will set in our build template; copy the contents into your own +`sample_script.ps1` and provide the path to it in your build template: + +```powershell +Write-Host "PACKER_BUILD_NAME is an env var Packer automatically sets for you." +Write-Host "...or you can set it in your builder variables." +Write-Host "The default for this builder is:" $Env:PACKER_BUILD_NAME + +Write-Host "The PowerShell provisioner will automatically escape characters" +Write-Host "considered special to PowerShell when it encounters them in" +Write-Host "your environment variables or in the PowerShell elevated" +Write-Host "username/password fields." +Write-Host "For example, VAR1 from our config is:" $Env:VAR1 +Write-Host "Likewise, VAR2 is:" $Env:VAR2 +Write-Host "VAR3 is:" $Env:VAR3 +Write-Host "Finally, VAR4 is:" $Env:VAR4 +Write-Host "None of the special characters needed escaping in the template" +``` + +Finally, we need to create the actual [build template]( +/docs/templates/index.html). +Remember, this template is the core configuration file that Packer uses to +understand what you want to build, and how you want to build it. + +As mentioned earlier, the specific builder we are using in this example +is the [Amazon EBS builder](/docs/builders/amazon-ebs.html). +The template below demonstrates use of the [`source_ami_filter`]( +/docs/builders/amazon-ebs.html#source_ami_filter) configuration option +available within the builder for automatically selecting the *latest* +suitable source Windows AMI provided by Amazon. +We also use the `user_data_file` configuration option provided by the builder +to reference the bootstrap file we created earlier. As you will recall, our +bootstrap file contained all the commands we needed to supply in advance of +actually spinning up the instance, so that later on, our instance is +configured to allow Packer to connect in to it. + +The `"provisioners"` section of the template demonstrates use of the +[powershell](/docs/provisioners/powershell.html) and +[windows-restart](/docs/provisioners/windows-restart.html) provisioners to +customize and control the build process: + +```json +{ + "variables": { + "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}", + "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}", + "region": "us-east-1" + }, + "builders": [ + { + "type": "amazon-ebs", + "access_key": "{{ user `aws_access_key` }}", + "secret_key": "{{ user `aws_secret_key` }}", + "region": "{{ user `region` }}", + "instance_type": "t2.micro", + "source_ami_filter": { + "filters": { + "virtualization-type": "hvm", + "name": "*Windows_Server-2012-R2*English-64Bit-Base*", + "root-device-type": "ebs" + }, + "most_recent": true, + "owners": "amazon" + }, + "ami_name": "packer-demo-{{timestamp}}", + "user_data_file": "./bootstrap_win.txt", + "communicator": "winrm", + "winrm_username": "Administrator", + "winrm_password": "SuperS3cr3t!" + } + ], + "provisioners": [ + { + "type": "powershell", + "environment_vars": ["DEVOPS_LIFE_IMPROVER=PACKER"], + "inline": [ + "Write-Host \"HELLO NEW USER; WELCOME TO $Env:DEVOPS_LIFE_IMPROVER\"", + "Write-Host \"You need to use backtick escapes when using\"", + "Write-Host \"characters such as DOLLAR`$ directly in a command\"", + "Write-Host \"or in your own scripts.\"" + ] + }, + { + "type": "windows-restart" + }, + { + "script": "./sample_script.ps1", + "type": "powershell", + "environment_vars": [ + "VAR1=A$Dollar", + "VAR2=A`Backtick", + "VAR3=A'SingleQuote", + "VAR4=A\"DoubleQuote" + ] + } + ] +} +``` + +Save the build template as `firstrun.json`. + +Next we need to set things up so that Packer is able to access and use our +AWS account. Set your access key and id as environment variables, so we +don't need to pass them in through the command line: + +``` +export AWS_ACCESS_KEY_ID=MYACCESSKEYID +export AWS_SECRET_ACCESS_KEY=MYSECRETACCESSKEY +``` + +Finally, we can create our new AMI by running `packer build firstrun.json` + +You should see output like this: + +``` +amazon-ebs output will be in this color. + +==> amazon-ebs: Prevalidating AMI Name: packer-demo-1518111383 + amazon-ebs: Found Image ID: ami-013e197b +==> amazon-ebs: Creating temporary keypair: packer_5a7c8a97-f27f-6708-cc3c-6ab9b4688b13 +==> amazon-ebs: Creating temporary security group for this instance: packer_5a7c8ab5-444c-13f2-0aa1-18d124cdb975 +==> amazon-ebs: Authorizing access to port 5985 from 0.0.0.0/0 in the temporary security group... +==> amazon-ebs: Launching a source AWS instance... +==> amazon-ebs: Adding tags to source instance + amazon-ebs: Adding tag: "Name": "Packer Builder" + amazon-ebs: Instance ID: i-0c8c808a3b945782a +==> amazon-ebs: Waiting for instance (i-0c8c808a3b945782a) to become ready... +==> amazon-ebs: Skipping waiting for password since WinRM password set... +==> amazon-ebs: Waiting for WinRM to become available... + amazon-ebs: WinRM connected. +==> amazon-ebs: Connected to WinRM! +==> amazon-ebs: Provisioning with Powershell... +==> amazon-ebs: Provisioning with powershell script: /var/folders/15/d0f7gdg13rnd1cxp7tgmr55c0000gn/T/packer-powershell-provisioner943573503 + amazon-ebs: HELLO NEW USER; WELCOME TO PACKER + amazon-ebs: You need to use backtick escapes when using + amazon-ebs: characters such as DOLLAR$ directly in a command + amazon-ebs: or in your own scripts. +==> amazon-ebs: Restarting Machine +==> amazon-ebs: Waiting for machine to restart... + amazon-ebs: WIN-NI8N45RPJ23 restarted. +==> amazon-ebs: Machine successfully restarted, moving on +==> amazon-ebs: Provisioning with Powershell... +==> amazon-ebs: Provisioning with powershell script: ./sample_script.ps1 + amazon-ebs: PACKER_BUILD_NAME is an env var Packer automatically sets for you. + amazon-ebs: ...or you can set it in your builder variables. + amazon-ebs: The default for this builder is: amazon-ebs + amazon-ebs: The PowerShell provisioner will automatically escape characters + amazon-ebs: considered special to PowerShell when it encounters them in + amazon-ebs: your environment variables or in the PowerShell elevated + amazon-ebs: username/password fields. + amazon-ebs: For example, VAR1 from our config is: A$Dollar + amazon-ebs: Likewise, VAR2 is: A`Backtick + amazon-ebs: VAR3 is: A'SingleQuote + amazon-ebs: Finally, VAR4 is: A"DoubleQuote + amazon-ebs: None of the special characters needed escaping in the template +==> amazon-ebs: Stopping the source instance... + amazon-ebs: Stopping instance, attempt 1 +==> amazon-ebs: Waiting for the instance to stop... +==> amazon-ebs: Creating the AMI: packer-demo-1518111383 + amazon-ebs: AMI: ami-f0060c8a +==> amazon-ebs: Waiting for AMI to become ready... +==> amazon-ebs: Terminating the source AWS instance... +==> amazon-ebs: Cleaning up any extra volumes... +==> amazon-ebs: No volumes to clean up, skipping +==> amazon-ebs: Deleting temporary security group... +==> amazon-ebs: Deleting temporary keypair... +Build 'amazon-ebs' finished. + +==> Builds finished. The artifacts of successful builds are: +--> amazon-ebs: AMIs were created: +us-east-1: ami-f0060c8a +``` + +And if you navigate to your EC2 dashboard you should see your shiny new AMI +listed in the main window of the Images -> AMIs section. + +Why stop there though? + +As you'll see, with one simple change to the template above, it's +just as easy to create your own Windows 2008 or Windows 2016 AMIs. Just +set the value for the name field within `source_ami_filter` as required: + +For Windows 2008 SP2: + +``` + "name": "*Windows_Server-2008-SP2*English-64Bit-Base*", +``` + +For Windows 2016: + +``` + "name": "*Windows_Server-2016-English-Full-Base*", +``` + +The bootstrapping and sample provisioning should work the same across all +Windows server versions. + [platforms]: /docs/builders/index.html diff --git a/website/source/intro/getting-started/install.html.md b/website/source/intro/getting-started/install.html.md index 3ccd45adb..884683e9f 100644 --- a/website/source/intro/getting-started/install.html.md +++ b/website/source/intro/getting-started/install.html.md @@ -4,7 +4,7 @@ sidebar_current: intro-getting-started-install page_title: Install Packer - Getting Started description: |- Packer must first be installed on the machine you want to run it on. To make - installation easy, Packer is distributed as a binary package for all supported + installation easier, Packer is distributed as a binary package for all supported platforms and architectures. This page will not cover how to compile Packer from source, as that is covered in the README and is only recommended for advanced users. @@ -13,10 +13,10 @@ description: |- # Install Packer Packer must first be installed on the machine you want to run it on. To make -installation easy, Packer is distributed as a [binary package](/downloads.html) +installation easier, Packer is distributed as a [binary package](/downloads.html) for all supported platforms and architectures. This page will not cover how to compile Packer from source, as that is covered in the -[README](https://github.com/mitchellh/packer/blob/master/README.md) and is only +[README](https://github.com/hashicorp/packer/blob/master/README.md) and is only recommended for advanced users. ## Installing Packer diff --git a/website/source/intro/getting-started/next.html.md b/website/source/intro/getting-started/next.html.md index 7a1de984b..fcc355164 100644 --- a/website/source/intro/getting-started/next.html.md +++ b/website/source/intro/getting-started/next.html.md @@ -20,11 +20,7 @@ From this point forward, the most important reference for you will be the [documentation](/docs/index.html). The documentation is less of a guide and more of a reference of all the overall features and options of Packer. -If you're interested in learning more about how Packer fits into the HashiCorp -ecosystem of tools, read our [Atlas getting started -overview](https://atlas.hashicorp.com/help/intro/getting-started). - As you use Packer more, please voice your comments and concerns on the [mailing list or IRC](/community.html). Additionally, Packer is [open -source](https://github.com/mitchellh/packer) so please contribute if you'd like +source](https://github.com/hashicorp/packer) so please contribute if you'd like to. Contributions are very welcome. diff --git a/website/source/intro/getting-started/parallel-builds.html.md b/website/source/intro/getting-started/parallel-builds.html.md index 2cd6a9286..ec5918da3 100644 --- a/website/source/intro/getting-started/parallel-builds.html.md +++ b/website/source/intro/getting-started/parallel-builds.html.md @@ -73,7 +73,7 @@ array. You'll also need to modify the `variables` section of the template to include the access keys for DigitalOcean. -```javascript +```json "variables": { "do_api_token": "", // ... @@ -166,7 +166,8 @@ us-east-1: ami-376d1d5e As you can see, Packer builds both the Amazon and DigitalOcean images in parallel. It outputs information about each in different colors (although you -can't see that in the block above) so that it is easy to identify. +can't see that in the block above), making it is easier to identify the actions +executed when you execute the command. At the end of the build, Packer outputs both of the artifacts created (an AMI and a DigitalOcean snapshot). Both images created are bare bones Ubuntu diff --git a/website/source/intro/getting-started/remote-builds.html.md b/website/source/intro/getting-started/remote-builds.html.md deleted file mode 100644 index 7ee554110..000000000 --- a/website/source/intro/getting-started/remote-builds.html.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -layout: intro -sidebar_current: intro-getting-started-remote-builds -page_title: Remote Builds and Storage - Getting Started -description: |- - Up to this point in the guide, you have been running Packer on your local - machine to build and provision images on AWS and DigitalOcean. However, you - can use Atlas by HashiCorp to both run Packer builds remotely and store the - output of builds. ---- - -# Remote Builds and Storage - -Up to this point in the guide, you have been running Packer on your local -machine to build and provision images on AWS and DigitalOcean. However, you can -use [Atlas by HashiCorp](https://atlas.hashicorp.com) to run Packer builds -remotely and store the output of builds. - -## Why Build Remotely? - -By building remotely, you can move access credentials off of developer machines, -release local machines from long-running Packer processes, and automatically -start Packer builds from trigger sources such as `vagrant push`, a version -control system, or CI tool. - -## Run Packer Builds Remotely - -To run Packer remotely, there are two changes that must be made to the Packer -template. The first is the addition of the `push` -[configuration](https://www.packer.io/docs/templates/push.html), which sends the -Packer template to Atlas so it can run Packer remotely. The second modification -is updating the variables section to read variables from the Atlas environment -rather than the local environment. Remove the `post-processors` section for now -if it is still in your template. - -```json -{ - "variables": { - "aws_access_key": "{{env `aws_access_key`}}", - "aws_secret_key": "{{env `aws_secret_key`}}" - }, - "builders": [{ - "type": "amazon-ebs", - "access_key": "{{user `aws_access_key`}}", - "secret_key": "{{user `aws_secret_key`}}", - "region": "us-east-1", - "source_ami": "ami-9eaa1cf6", - "instance_type": "t2.micro", - "ssh_username": "ubuntu", - "ami_name": "packer-example {{timestamp}}" - }], - "provisioners": [{ - "type": "shell", - "inline": [ - "sleep 30", - "sudo apt-get update", - "sudo apt-get install -y redis-server" - ] - }], - "push": { - "name": "ATLAS_USERNAME/packer-tutorial" - } -} -``` - -To get an Atlas username, [create an account -here](https://atlas.hashicorp.com/account/new?utm_source=oss&utm_medium=getting-started&utm_campaign=packer). -Replace "ATLAS\_USERNAME" with your username, then run -`packer push -create example.json` to send the configuration to Atlas, which -automatically starts the build. - -This build will fail since neither `aws_access_key` or `aws_secret_key` are set -in the Atlas environment. To set environment variables in Atlas, navigate to -the [Builds tab](https://atlas.hashicorp.com/builds), click the -"packer-tutorial" build configuration that was just created, and then click -'variables' in the left navigation. Set `aws_access_key` and `aws_secret_key` -with their respective values. Now restart the Packer build by either clicking -'rebuild' in the Atlas UI or by running `packer push example.json` again. Now -when you click on the active build, you can view the logs in real-time. - --> **Note:** Whenever a change is made to the Packer template, you must -`packer push` to update the configuration in Atlas. - -## Store Packer Outputs - -Now we have Atlas building an AMI with Redis pre-configured. This is great, but -it's even better to store and version the AMI output so it can be easily -deployed by a tool like [Terraform](https://www.terraform.io). The `atlas` -[post-processor](/docs/post-processors/atlas.html) makes this process simple: - -```json -{ - "variables": ["..."], - "builders": ["..."], - "provisioners": ["..."], - "push": ["..."], - "post-processors": [{ - "type": "atlas", - "artifact": "ATLAS_USERNAME/packer-tutorial", - "artifact_type": "amazon.image" - }] -} -``` - -Update the `post-processors` block with your Atlas username, then -`packer push example.json` and watch the build kick off in Atlas! When the build -completes, the resulting artifact will be saved and stored in Atlas. diff --git a/website/source/intro/hashicorp-ecosystem.html.md b/website/source/intro/hashicorp-ecosystem.html.md deleted file mode 100644 index a54d8c107..000000000 --- a/website/source/intro/hashicorp-ecosystem.html.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: intro -sidebar_current: intro-ecosystem -page_title: Packer and the HashiCorp Ecosystem - Introduction -description: |- - Learn how Packer fits in with the rest of the HashiCorp ecosystem of tools ---- - -# Packer and the HashiCorp Ecosystem - -HashiCorp is the creator of the open source projects Vagrant, Packer, Terraform, -Serf, and Consul, and the commercial product Atlas. Packer is just one piece of -the ecosystem HashiCorp has built to make application delivery a versioned, -auditable, repeatable, and collaborative process. To learn more about our -beliefs on the qualities of the modern datacenter and responsible application -delivery, read [The Atlas Mindset: Version Control for -Infrastructure](https://www.hashicorp.com/blog/atlas-mindset.html?utm_source=packer&utm_campaign=HashicorpEcosystem). - -If you are using Packer to build machine images and deployable artifacts, it's -likely that you need a solution for deploying those artifacts. Terraform is our -tool for creating, combining, and modifying infrastructure. - -Below are summaries of HashiCorp's open source projects and a graphic showing -how Atlas connects them to create a full application delivery workflow. - -# HashiCorp Ecosystem - -![Atlas Workflow](docs/atlas-workflow.png) - -[Atlas](https://atlas.hashicorp.com/?utm_source=packer&utm_campaign=HashicorpEcosystem) -is HashiCorp's only commercial product. It unites Packer, Terraform, and Consul -to make application delivery a versioned, auditable, repeatable, and -collaborative process. - -[Packer](https://www.packer.io/?utm_source=packer&utm_campaign=HashicorpEcosystem) -is a HashiCorp tool for creating machine images and deployable artifacts such as -AMIs, OpenStack images, Docker containers, etc. - -[Terraform](https://www.terraform.io/?utm_source=packer&utm_campaign=HashicorpEcosystem) -is a HashiCorp tool for creating, combining, and modifying infrastructure. In -the Atlas workflow Terraform reads from the artifact registry and provisions -infrastructure. - -[Consul](https://www.consul.io/?utm_source=packer&utm_campaign=HashicorpEcosystem) -is a HashiCorp tool for service discovery, service registry, and health checks. -In the Atlas workflow Consul is configured at the Packer build stage and -identifies the service(s) contained in each artifact. Since Consul is configured -at the build phase with Packer, when the artifact is deployed with Terraform, it -is fully configured with dependencies and service discovery pre-baked. This -greatly reduces the risk of an unhealthy node in production due to configuration -failure at runtime. - -[Serf](https://www.serf.io/?utm_source=packer&utm_campaign=HashicorpEcosystem) is -a HashiCorp tool for cluster membership and failure detection. Consul uses -Serf's gossip protocol as the foundation for service discovery. - -[Vagrant](https://www.vagrantup.com/?utm_source=packer&utm_campaign=HashicorpEcosystem) -is a HashiCorp tool for managing development environments that mirror -production. Vagrant environments reduce the friction of developing a project and -reduce the risk of unexpected behavior appearing after deployment. Vagrant boxes -can be built in parallel with production artifacts with Packer to maintain -parity between development and production. diff --git a/website/source/layouts/_sidebar.erb b/website/source/layouts/_sidebar.erb index c5f72ea78..d13902499 100644 --- a/website/source/layouts/_sidebar.erb +++ b/website/source/layouts/_sidebar.erb @@ -10,6 +10,7 @@
  • Guides
  • Docs
  • Community
  • +
  • Press Kit
  • @@ -21,7 +22,7 @@
  • - + <%= inline_svg "github.svg" %> GitHub
  • diff --git a/website/source/layouts/community.erb b/website/source/layouts/community.erb new file mode 100644 index 000000000..a5ab417c3 --- /dev/null +++ b/website/source/layouts/community.erb @@ -0,0 +1,19 @@ +<% wrap_layout :inner do %> + <% content_for :sidebar do %> + + <% end %> + + <%= yield %> +<% end %> diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 45c92ed98..552b154ab 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -59,6 +59,9 @@ > Builders