Skip to content

Commit

Permalink
Merge branch 'master' into subnet_az_discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinHebert committed Jan 6, 2016
2 parents a08725f + d507b18 commit e4930e7
Show file tree
Hide file tree
Showing 635 changed files with 28,509 additions and 17,631 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
.DS_Store
.vagrant
test/.env

website/.bundle
website/vendor

packer-test*.log
15 changes: 2 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@ sudo: false
language: go

go:
- 1.2
- 1.3
- 1.4
- 1.5
- tip

install: make updatedeps

script:
- GOMAXPROCS=2 make test
#- go test -race ./...
- GOMAXPROCS=2 make ci

branches:
only:
- master

notifications:
irc:
channels:
- "irc.freenode.org#packer-tool"
skip_join: true
use_notice: true

matrix:
fast_finish: true
allow_failures:
Expand Down
318 changes: 311 additions & 7 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ it raises the chances we can quickly merge or address your contributions.
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.

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.
1. Install Go. Make sure the Go version is at least Go 1.4. Packer will not work with anything less than
Go 1.4. On a Mac, you can `brew install go` to install Go 1.4.

2. Set and export the `GOPATH` environment variable and update your `PATH`.
For example, you can add to your `.bash_profile`.
Expand Down
91 changes: 71 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,84 @@
TEST?=./...
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
# Get the current full sha from git
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)

default: test
default: test dev

bin:
ci: deps test

release: updatedeps test releasebin

bin: deps
@echo "WARN: 'make bin' is for debug / test builds only. Use 'make release' for release builds."
@sh -c "$(CURDIR)/scripts/build.sh"

dev:
@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
releasebin: deps
@grep 'const VersionPrerelease = ""' version.go > /dev/null ; if [ $$? -ne 0 ]; then \
echo "ERROR: You must remove prerelease tags from version.go prior to release."; \
exit 1; \
fi
@sh -c "$(CURDIR)/scripts/build.sh"

test:
go test $(TEST) $(TESTARGS) -timeout=10s
@$(MAKE) vet
deps:
go get -v -d ./...

testrace:
go test -race $(TEST) $(TESTARGS)
dev: deps
@grep 'const VersionPrerelease = ""' version.go > /dev/null ; if [ $$? -eq 0 ]; then \
echo "ERROR: You must add prerelease tags to version.go prior to making a dev build."; \
exit 1; \
fi
@PACKER_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"

updatedeps:
go get -d -v -p 2 ./...
# generate runs `go generate` to build the dynamically generated
# source files.
generate: deps
go generate ./...

vet:
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
test: deps
go test $(TEST) $(TESTARGS) -timeout=15s | tee packer-test.log
@go vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for reviewal."; \
@go vet $(TEST) ; if [ $$? -eq 1 ]; then \
echo "ERROR: Vet found problems in the code."; \
exit 1; \
fi

# testacc runs acceptance tests
testacc: deps generate
@echo "WARN: Acceptance tests will take a long time to run and may cost money. Ctrl-C if you want to cancel."
PACKER_ACC=1 go test -v $(TEST) $(TESTARGS) -timeout=45m | tee packer-test-acc.log

testrace: deps
go test -race $(TEST) $(TESTARGS) -timeout=15s | tee packer-test-race.log

# `go get -u` causes git to revert packer to the master branch. This causes all
# kinds of headaches. We record the git sha when make starts try to correct it
# if we detect dift. DO NOT use `git checkout -f` for this because it will wipe
# out your changes without asking.
updatedeps:
@echo "INFO: Currently on $(GITBRANCH) ($(GITSHA))"
@git diff-index --quiet HEAD ; if [ $$? -ne 0 ]; then \
echo "ERROR: Your git working tree has uncommitted changes. updatedeps will fail. Please stash or commit your changes first."; \
exit 1; \
fi
go get -u github.com/mitchellh/gox
go get -u golang.org/x/tools/cmd/stringer
go list ./... \
| xargs go list -f '{{join .Deps "\n"}}' \
| grep -v github.com/mitchellh/packer \
| grep -v '/internal/' \
| sort -u \
| xargs go get -f -u -v -d ; if [ $$? -ne 0 ]; then \
echo "ERROR: go get failed. Your git branch may have changed; you were on $(GITBRANCH) ($(GITSHA))."; \
fi
@if [ "$(GITBRANCH)" != "" ]; then git checkout -q $(GITBRANCH); else git checkout -q $(GITSHA); fi
@if [ `git rev-parse HEAD` != "$(GITSHA)" ]; then \
echo "ERROR: git checkout has drifted and we weren't able to correct it. Was $(GITBRANCH) ($(GITSHA))"; \
exit 1; \
fi
@echo "INFO: Currently on $(GITBRANCH) ($(GITSHA))"

.PHONY: bin default test updatedeps vet
.PHONY: bin checkversion ci default deps generate releasebin test testacc testrace updatedeps
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Packer

[![Build Status](https://travis-ci.org/mitchellh/packer.svg?branch=master)](https://travis-ci.org/mitchellh/packer)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/mitchellh/packer?branch=master&svg=true)](https://ci.appveyor.com/project/hashicorp/packer)

* Website: http://www.packer.io
* IRC: `#packer-tool` on Freenode
Expand Down Expand Up @@ -41,15 +42,19 @@ for your operating system or [compile Packer yourself](#developing-packer).
After Packer is installed, create your first template, which tells Packer
what platforms to build images for and how you want to build them. In our
case, we'll create a simple AMI that has Redis pre-installed. Save this
file as `quick-start.json`. Be sure to replace any credentials with your
own.
file as `quick-start.json`. Export your AWS credentials as the
`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.

```json
{
"variables": {
"access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "YOUR KEY HERE",
"secret_key": "YOUR SECRET KEY HERE",
"access_key": "{{user `access_key`}}",
"secret_key": "{{user `access_key`}}",
"region": "us-east-1",
"source_ami": "ami-de0d9eb7",
"instance_type": "t1.micro",
Expand Down Expand Up @@ -81,7 +86,7 @@ http://www.packer.io/docs
## Developing Packer

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
you'll first need [Go](http://www.golang.org) installed (version 1.4+ is
_required_). Make sure Go is properly installed, including setting up
a [GOPATH](http://golang.org/doc/code.html#GOPATH).

Expand Down Expand Up @@ -121,3 +126,35 @@ package by specifying the `TEST` variable. For example below, only

$ make test TEST=./packer
...

### Acceptance Tests

Packer has comprehensive [acceptance tests](https://en.wikipedia.org/wiki/Acceptance_testing)
covering the builders of Packer.

If you're working on a feature of a builder or a new builder 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 real costs in some cases. In the presence of a bug, it is technically
possible that broken backends could leave dangling data behind. Therefore,
please run the acceptance tests at your own risk. At the very least,
we recommend running them in their own private account for whatever builder
you're testing.

To run the acceptance tests, invoke `make testacc`:

```sh
$ make testacc TEST=./builder/amazon/ebs
...
```

The `TEST` variable is required, and you should specify the folder where the
backend is. 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.

Acceptance tests typically require other environment variables to be set for
things such as access keys. The test itself should error early and tell
you what to set, so it is not documented here.
39 changes: 39 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# appveyor.yml reference : http://www.appveyor.com/docs/appveyor-yml

version: "{build}"

skip_tags: true

branches:
only:
- master

os: Windows Server 2012 R2

environment:
GOPATH: c:\gopath
matrix:
- GOARCH: 386
GOVERSION: 1.4.2
- GOARCH: amd64
GOVERSION: 1.4.2

clone_folder: c:\gopath\src\github.com\mitchellh\packer

install:
- set Path=c:\go\bin;%Path%
- echo %Path%
- appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-%GOARCH%.msi
- msiexec /i go%GOVERSION%.windows-%GOARCH%.msi /q
- go version
- go env
- go get -d -v -t ./...

build_script:
- go test -v ./...
- go vet ./...
- git rev-parse HEAD

test: off

deploy: off
Loading

0 comments on commit e4930e7

Please sign in to comment.