diff --git a/.gitignore b/.gitignore index d9d37c96f..a0e0b48d8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ /website/build .DS_Store .vagrant -Vagrantfile test/.env diff --git a/.travis.yml b/.travis.yml index 1a81bef54..4fac7ab93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,20 +2,14 @@ language: go go: - 1.2 + - 1.3 - tip -install: make deps +install: make updatedeps script: - - go test ./... + - GOMAXPROCS=2 make test #- go test -race ./... -notifications: - irc: - channels: - - "chat.freenode.net#packer-tool" - on_success: change - on_failure: always - matrix: allow_failures: - go: tip diff --git a/CHANGELOG.md b/CHANGELOG.md index 2927455c8..f24003bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,238 @@ -## 0.6.0 (unreleased) +## 0.8.0 (unreleased) + + + +## 0.7.2 (October 28, 2014) + +FEATURES: + + * builder/digitalocean: API V2 support. [GH-1463] + * builder/parallels: Don't depend on _prl-utils_ [GH-1499] + +IMPROVEMENTS: + + * builder/amazon/all: Support new AWS Frankfurt region. + * builder/docker: Allow remote `DOCKER_HOST`, which works as long as + volumes work. [GH-1594] + * builder/qemu: Can set cache mode for main disk. [GH-1558] + * builder/qemu: Can build from pre-existing disk. [GH-1342] + * builder/vmware: Can specify path to Fusion installation with environmental + variable `FUSION_APP_PATH`. [GH-1552] + * builder/vmware: Can specify the HW version for the VMX. [GH-1530] + * builder/vmware/esxi: Will now cache ISOs/floppies remotely. [GH-1479] + * builder/vmware/vmx: Source VMX can have a disk connected via SATA. [GH-1604] + * post-processors/vagrant: Support Qemu (libvirt) boxes. [GH-1330] + * post-processors/vagrantcloud: Support self-hosted box URLs. + +BUG FIXES: + + * core: Fix loading plugins from pwd. [GH-1521] + * builder/amazon: Prefer token in config if given. [GH-1544] + * builder/amazon/all: Extended timeout for waiting for AMI. [GH-1533] + * builder/virtualbox: Can read VirtualBox version on FreeBSD. [GH-1570] + * builder/virtualbox: More robust reading of guest additions URL. [GH-1509] + * builder/vmware: Always remove floppies/drives. [GH-1504] + * builder/vmware: Wait some time so that post-VMX update aren't + overwritten. [GH-1504] + * builder/vmware/esxi: Retry power on if it fails. [GH-1334] + * builder/vmware-vmx: Fix issue with order of boot command support [GH-1492] + * builder/amazon: Extend timeout and allow user override [GH-1533] + * builder/parallels: Ignore 'The fdd0 device does not exist' [GH-1501] + * builder/parallels: Rely on Cleanup functions to detach devices [GH-1502] + * builder/parallels: Create VM without hdd and then add it later [GH-1548] + * builder/parallels: Disconnect cdrom0 [GH-1605] + * builder/qemu: Don't use `-redir` flag anymore, replace with + `hostfwd` options. [GH-1561] + * builder/qmeu: Use `pc` as default machine type instead of `pc-1.0`. + * providers/aws: Ignore transient network errors. [GH-1579] + * provisioner/ansible: Don't buffer output so output streams in. [GH-1585] + * provisioner/ansible: Use inventory file always to avoid potentially + deprecated feature. [GH-1562] + * provisioner/shell: Quote environmental variables. [GH-1568] + * provisioner/salt: Bootstrap over SSL. [GH-1608] + * post-processors/docker-push: Work with docker-tag artifacts. [GH-1526] + * post-processors/vsphere: Append "/" to object address. [GH-1615] + +## 0.7.1 (September 10, 2014) + +FEATURES: + + * builder/vmware: VMware Fusion Pro 7 is now supported. [GH-1478] + +BUG FIXES: + + * core: SSH will connect slightly faster if it is ready immediately. + * provisioner/file: directory uploads no longer hang. [GH-1484] + * provisioner/file: fixed crash on large files. [GH-1473] + * scripts: Windows executable renamed to packer.exe. [GH-1483] + +## 0.7.0 (September 8, 2014) + +BACKWARDS INCOMPATIBILITIES: + + * The authentication configuration for Google Compute Engine has changed. + The new method is much simpler, but is not backwards compatible. + `packer fix` will _not_ fix this. Please read the updated GCE docs. + +FEATURES: + + * **New Post-Processor: `compress`** - Gzip compresses artifacts with files. + * **New Post-Processor: `docker-save`** - Save an image. This is similar to + export, but preserves the image hierarchy. + * **New Post-Processor: `docker-tag`** - Tag a created image. + * **New Template Functions: `upper`, `lower`** - See documentation for + more details. + * core: Plugins are automatically discovered if they're named properly. + Packer will look in the PWD and the directory with `packer` for + binaries named `packer-TYPE-NAME`. + * core: Plugins placed in `~/.packer.d/plugins` are now automatically + discovered. + * builder/amazon: Spot instances can now be used to build EBS backed and + instance store images. [GH-1139] + * builder/docker: Images can now be committed instead of exported. [GH-1198] + * builder/virtualbox-ovf: New `import_flags` setting can be used to add + new command line flags to `VBoxManage import` to allow things such + as EULAs to be accepted. [GH-1383] + * builder/virtualbox-ovf: Boot commands and the HTTP server are supported. + [GH-1169] + * builder/vmware: VMware Player 6 is now supported. [GH-1168] + * builder/vmware-vmx: Boot commands and the HTTP server are supported. + [GH-1169] + +IMPROVEMENTS: + + * core: `isotime` function can take a format. [GH-1126] + * builder/amazon/all: `AWS_SECURITY_TOKEN` is read and can also be + set with the `token` configuration. [GH-1236] + * builder/amazon/all: Can force SSH on the private IP address with + `ssh_private_ip`. [GH-1229] + * builder/amazon/all: String fields in device mappings can use variables. [GH-1090] + * builder/amazon-instance: EBS AMIs can be used as a source. [GH-1453] + * builder/digitalocean: Can set API URL endpoint. [GH-1448] + * builder/digitalocean: Region supports variables. [GH-1452] + * builder/docker: Can now specify login credentials to pull images. + * builder/docker: Support mounting additional volumes. [GH-1430] + * builder/parallels/all: Path to tools ISO is calculated automatically. [GH-1455] + * builder/parallels-pvm: `reassign_mac` option to choose wehther or not + to generate a new MAC address. [GH-1461] + * builder/qemu: Can specify "none" acceleration type. [GH-1395] + * builder/qemu: Can specify "tcg" acceleration type. [GH-1395] + * builder/virtualbox/all: `iso_interface` option to mount ISO with SATA. [GH-1200] + * builder/vmware-vmx: Proper `floppy_files` support. [GH-1057] + * command/build: Add `-color=false` flag to disable color. [GH-1433] + * post-processor/docker-push: Can now specify login credentials. [GH-1243] + * provisioner/chef-client: Support `chef_environment`. [GH-1190] + +BUG FIXES: + + * core: nicer error message if an encrypted private key is used for + SSH. [GH-1445] + * core: Fix crash that could happen with a well timed double Ctrl-C. + [GH-1328] [GH-1314] + * core: SSH TCP keepalive period is now 5 seconds (shorter). [GH-1232] + * builder/amazon-chroot: Can properly build HVM images now. [GH-1360] + * builder/amazon-chroot: Fix crash in root device check. [GH-1360] + * builder/amazon-chroot: Add description that Packer made the snapshot + with a time. [GH-1388] + * builder/amazon-ebs: AMI is deregistered if an error. [GH-1186] + * builder/amazon-instance: Fix deprecation warning for `ec2-bundle-vol` + [GH-1424] + * builder/amazon-instance: Add `--no-filter` to the `ec2-bundle-vol` + command by default to avoid corrupting data by removing package + manager certs. [GH-1137] + * builder/amazon/all: `delete_on_termination` set to false will work. + * builder/amazon/all: Fix race condition on setting tags. [GH-1367] + * builder/amazon/all: More desctriptive error messages if Amazon only + sends an error code. [GH-1189] + * builder/docker: Error if `DOCKER_HOST` is set. + * builder/docker: Remove the container during cleanup. [GH-1206] + * builder/docker: Fix case where not all output would show up from + provisioners. + * builder/googlecompute: add `disk_size` option. [GH-1397] + * builder/googlecompute: Auth works with latest formats on Google Cloud + Console. [GH-1344] + * builder/openstack: Region is not required. [GH-1418] + * builder/parallels-iso: ISO not removed from VM after install [GH-1338] + * builder/parallels/all: Add support for Parallels Desktop 10 [GH-1438] + * builder/parallels/all: Added some navigation keys [GH-1442] + * builder/qemu: If headless, sdl display won't be used. [GH-1395] + * builder/qemu: Use `512M` as `-m` default. [GH-1444] + * builder/virtualbox/all: Search `VBOX_MSI_INSTALL_PATH` for path to + `VBoxManage` on Windows. [GH-1337] + * builder/virtualbox/all: Seed RNG to avoid same ports. [GH-1386] + * builder/virtualbox/all: Better error if guest additions URL couldn't be + detected. [GH-1439] + * builder/virtualbox/all: Detect errors even when `VBoxManage` exits + with a zero exit code. [GH-1119] + * builder/virtualbox/iso: Append timestamp to default name for parallel + builds. [GH-1365] + * builder/vmware/all: No more error when Packer stops an already-stopped + VM. [GH-1300] + * builder/vmware/all: `ssh_host` accepts templates. [GH-1396] + * builder/vmware/all: Don't remount floppy in VMX post step. [GH-1239] + * builder/vmware/vmx: Do not re-add floppy disk files to VMX [GH-1361] + * builder/vmware-iso: Fix crash when `vnc_port_min` and max were the + same value. [GH-1288] + * builder/vmware-iso: Finding an available VNC port on Windows works. [GH-1372] + * builder/vmware-vmx: Nice error if Clone is not supported (not VMware + Fusion Pro). [GH-787] + * post-processor/vagrant: Can supply your own metadata.json. [GH-1143] + * provisioner/ansible-local: Use proper path on Windows. [GH-1375] + * provisioner/file: Mode will now be preserved. [GH-1064] + +## 0.6.1 (July 20, 2014) + +FEATURES: + + * **New post processor:** `vagrant-cloud` - Push box files generated by + vagrant post processor to Vagrant Cloud. [GH-1289] + * Vagrant post-processor can now packer Hyper-V boxes. + +IMPROVEMENTS: + + * builder/amazon: Support for enhanced networking on HVM images. [GH-1228] + * builder/amazon-ebs: Support encrypted EBS volumes [GH-1194] + * builder/ansible: Add `playbook_dir` option. [GH-1000] + * builder/openstack: Add ability to configure networks. [GH-1261] + * builder/openstack: Skip certificate verification. [GH-1121] + * builder/parallels/all: Add ability to select interface to connect to. + * builder/parallels/pvm: Support `boot_command`. [GH-1082] + * builder/virtualbox/all: Attempt to use local guest additions ISO + before downloading from internet. [GH-1123] + * builder/virtualbox/ovf: Supports `guest_additions_mode` [GH-1035] + * builder/vmware/all: Increase cleanup timeout to 120 seconds [GH-1167] + * builder/vmware/all: Add `vmx_data_post` for modifying VMX data + after shutdown. [GH-1149] + * builder/vmware/vmx: Supports tools uploading. [GH-1154] + +BUG FIXES: + + * core: `isotime` is the same time during the entire build. [GH-1153] + * builder/amazon-common: Sort AMI strings before outputting [GH-1305] + * builder/amazon: User data can use templates/variables. [GH-1343] + * builder/amazon: Can now build AMIs in GovCloud. + * builder/null: SSH info can use templates/variables. [GH-1343] + * builder/openstack: Workaround for gophercloud.ServerById crashing [GH-1257] + * builder/openstack: Force IPv4 addresses from address pools [GH-1258] + * builder/parallels: Do not delete entire CDROM device. [GH-1115] + * builder/parallels: Errors while creating floppy disk. [GH-1225] + * builder/parallels: Errors while removing floppy drive. [GH-1226] + * builder/virtualbox-ovf: Supports guest additions options. [GH-1120] + * builder/vmware-iso: Fix esx5 path separator in windows. [GH-1316] + * builder/vmware: Remote ESXi builder now uploads floppy. [GH-1106] + * builder/vmware: Remote ESXi builder no longer re-uploads ISO every + time. [GH-1244] + * post-processor/vsphere: Accept DOMAIN\account usernames [GH-1178] + * provisioner/chef-*: Fix remotePaths for Windows [GH-394] + +## 0.6.0 (May 2, 2014) FEATURES: * **New builder:** `null` - The null builder does not produce any artifacts, but is useful for debugging provisioning scripts. [GH-970] + * **New builder:** `parallels-iso` and `parallels-pvm` - These can be + used to build Parallels virtual machines. [GH-1101] * **New provisioner:** `chef-client` - Provision using a the `chef-client` command, which talks to a Chef Server. [GH-855] * **New provisioner:** `puppet-server` - Provision using Puppet by @@ -19,17 +248,28 @@ IMPROVEMENTS: array configurations. [GH-950] * builder/amazon: Added `ssh_private_key_file` option [GH-971] * builder/amazon: Added `ami_virtualization_type` option [GH-1021] + * builder/digitalocean: Regions, image names, and sizes can be + names that are looked up for their valid ID. [GH-960] * builder/googlecompute: Configurable instance name. [GH-1065] * builder/openstack: Support for conventional OpenStack environmental variables such as `OS_USERNAME`, `OS_PASSWORD`, etc. [GH-768] * builder/openstack: Support `openstack_provider` option to automatically fill defaults for different OpenStack variants. [GH-912] + * builder/openstack: Support security groups. [GH-848] * builder/qemu: User variable expansion in `ssh_key_path` [GH-918] + * builder/qemu: Floppy disk files list can also include globs + and directories. [GH-1086] * builder/virtualbox: Support an `export_opts` option which allows specifying arbitrary arguments when exporting the VM. [GH-945] + * builder/virtualbox: Added `vboxmanage_post` option to run vboxmanage + commands just before exporting [GH-664] + * builder/virtualbox: Floppy disk files list can also include globs + and directories. [GH-1086] * builder/vmware: Workstation 10 support for Linux. [GH-900] * builder/vmware: add cloning support on Windows [GH-824] - * command/build: Added '-parallel' flag so you can disable parallelization + * builder/vmware: Floppy disk files list can also include globs + and directories. [GH-1086] + * command/build: Added `-parallel` flag so you can disable parallelization with `-no-parallel`. [GH-924] * post-processors/vsphere: `disk_mode` option. [GH-778] * provisioner/ansible: Add `inventory_file` option [GH-1006] @@ -52,10 +292,13 @@ BUG FIXES: Windows [GH-963] * provisioner/ansible: set cwd to staging directory [GH-1016] * provisioners/chef-client: Don't chown directory with Ubuntu. [GH-939] + * provisioners/chef-solo: Deeply nested JSON works properly. [GH-1076] * provisioners/shell: Env var values can have equal signs. [GH-1045] * provisioners/shell: chmod the uploaded script file to 0777. [GH-994] * post-processor/docker-push: Allow repositories with ports. [GH-923] * post-processor/vagrant: Create parent directories for `output` path [GH-1059] + * post-processor/vsphere: datastore, network, and folder are no longer + required. [GH-1091] ## 0.5.2 (02/21/2014) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe691d1f6..de8b8fb60 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,19 +56,32 @@ following steps in order to be able to compile and test Packer. 1. Install Go. Make sure the Go version is at least Go 1.2. Packer will not work with anything less than Go 1.2. On a Mac, you can `brew install go` to install Go 1.2. -2. Set and export the `GOPATH` environment variable. For example, you can - add `export GOPATH=$HOME/Documents/golang` to your `.bash_profile`. +2. Set and export the `GOPATH` environment variable and update your `PATH`. + For example, you can add to your `.bash_profile`. -3. Download the Packer source (and its dependencies) by running + ``` + export GOPATH=$HOME/Documents/golang + export PATH=$PATH:$GOPATH/bin + ``` + +3. Install and build `gox` with + + ``` + go get github.com/mitchellh/gox + cd $GOPATH/src/github.com/mitchellh/gox + go build + ``` + +4. 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`. -4. Make your changes to the Packer source. You can run `make` from the main +5. Make your changes to the Packer source. You can run `make` from the main source directory to recompile all the binaries. Any compilation errors will be shown when the binaries are rebuilding. -5. Test your changes by running `make test` and then running +6. Test your changes by running `make test` and then running `$GOPATH/src/github.com/mitchellh/packer/bin/packer` to build a machine. -6. If everything works well and the tests pass, run `go fmt` on your code +7. If everything works well and the tests pass, run `go fmt` on your code before submitting a pull request. diff --git a/Makefile b/Makefile index a39e8ee0e..f03b010f5 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,20 @@ -NO_COLOR=\033[0m -OK_COLOR=\033[32;01m -ERROR_COLOR=\033[31;01m -WARN_COLOR=\033[33;01m -DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...) -UNAME := $(shell uname -s) -ifeq ($(UNAME),Darwin) -ECHO=echo -else -ECHO=/bin/echo -e -endif +TEST?=./... -all: deps - @mkdir -p bin/ - @$(ECHO) "$(OK_COLOR)==> Building$(NO_COLOR)" - @bash --norc -i ./scripts/devcompile.sh +default: test -deps: - @$(ECHO) "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)" - @go get -d -v ./... - @echo $(DEPS) | xargs -n1 go get -d +bin: + @sh -c "$(CURDIR)/scripts/build.sh" + +dev: + @TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh" + +test: + go test $(TEST) $(TESTARGS) -timeout=10s + +testrace: + go test -race $(TEST) $(TESTARGS) updatedeps: - @$(ECHO) "$(OK_COLOR)==> Updating all dependencies$(NO_COLOR)" - @go get -d -v -u ./... - @echo $(DEPS) | xargs -n1 go get -d -u + go get -d -v -p 2 ./... -clean: - @rm -rf bin/ local/ pkg/ src/ website/.sass-cache website/build - -format: - go fmt ./... - -test: deps - @$(ECHO) "$(OK_COLOR)==> Testing Packer...$(NO_COLOR)" - go test ./... - -.PHONY: all clean deps format test updatedeps +.PHONY: bin default test updatedeps diff --git a/README.md b/README.md index 721bdf586..6104e59d3 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,18 @@ from a single source configuration. Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. -Packer comes out of the box with support for creating AMIs (EC2), VMware -images, and VirtualBox images. Support for more platforms can be added via -plugins. +Packer comes out of the box with support for the following platforms: +* Amazon EC2 (AMI). Both EBS-backed and instance-store AMIs +* DigitalOcean +* Docker +* Google Compute Engine +* OpenStack +* Parallels +* QEMU. Both KVM and Xen images. +* VirtualBox +* VMware + +Support for other platforms can be added via plugins. The images that Packer creates can easily be turned into [Vagrant](http://www.vagrantup.com) boxes. @@ -69,40 +78,44 @@ http://www.packer.io/docs ## Developing Packer -If you wish to work on Packer itself, you'll first need [Go](http://golang.org) -installed (version 1.2+ is _required_). Make sure you have Go properly installed, -including setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH). +If you wish to work on Packer itself or any of its built-in providers, +you'll first need [Go](http://www.golang.org) installed (version 1.2+ is +_required_). Make sure Go is properly installed, including setting up +a [GOPATH](http://golang.org/doc/code.html#GOPATH). -For some additional dependencies, Go needs [Mercurial](http://mercurial.selenic.com/) -and [Bazaar](http://bazaar.canonical.com/en/) to be installed. -Packer itself doesn't require these, but a dependency of a dependency does. +Next, install the following software packages, which are needed for some dependencies: -You'll also need [`gox`](https://github.com/mitchellh/gox) -to compile packer. You can install that with: +- [Bazaar](http://bazaar.canonical.com/en/) +- [Git](http://git-scm.com/) +- [Mercurial](http://mercurial.selenic.com/) -``` -$ go get -u github.com/mitchellh/gox -``` +Then, install [Gox](https://github.com/mitchellh/gox), which is used +as a compilation tool on top of Go: -Next, clone this repository into `$GOPATH/src/github.com/mitchellh/packer` and -then just type `make`. In a few moments, you'll have a working `packer` executable: + $ go get -u github.com/mitchellh/gox -``` -$ make -... -$ bin/packer -... -``` +Next, clone this repository into `$GOPATH/src/github.com/mitchellh/packer`. +Install the necessary dependencies by running `make updatedeps` and then just +type `make`. This will compile some more dependencies and then run the tests. If +this exits with exit status 0, then everything is working! -If you need to cross-compile Packer for other platforms, take a look at -`scripts/dist.sh`. + $ make updatedeps + ... + $ make + ... -You can run tests by typing `make test`. +To compile a development version of Packer and the built-in plugins, +run `make dev`. This will put Packer binaries in the `bin` folder: -This will run tests for Packer core along with all the core builders and commands and such that come with Packer. + $ make dev + ... + $ bin/packer + ... -If you make any changes to the code, run `make format` in order to automatically -format the code according to Go standards. -When new dependencies are added to packer you can use `make updatedeps` to -get the latest and subsequently use `make` to compile and generate the `packer` binary. +If you're developing a specific package, you can run tests for just that +package by specifying the `TEST` variable. For example below, only +`packer` package tests will be run. + + $ make test TEST=./packer + ... diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..8397a0fd6 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,45 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +$script = < - - -