Commit Graph

107 Commits

Author SHA1 Message Date
Radek Simko
7860f55e4f
Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
Peter Dave Hello
0c63c7c854 build/Makefile: Properly exclude files under "./vendor/" path for go fmt (#19097)
Properly exclude files under "./vendor/" path, and find "files" only.
The original method "might" found "directories" with the same naming,
or, might exclude occasionally exclude the go files with "vendor" string
in any part of its path.
2019-09-06 08:58:34 -04:00
Radek Simko
01bc8898fc
make: Add check for protobuf dependencies 2019-09-05 14:30:54 +02:00
Martin Atkins
a9274beaca build: Run "go generate" in modules mode
It seems that all of the tools we run here are now sufficiently
modules-aware to run without problems in modules mode, and indeed running
_not_ in modules mode was causing problems with locating packages in
mockgen.
2019-02-06 11:19:44 -08:00
Radek Simko
357dcc924f
make: Make test-compile module-aware 2019-02-01 13:18:51 +00:00
Radek Simko
5691c8b337
make: Pull all generate dependencies before generating 2019-01-29 23:07:01 +00:00
James Bardin
a24e307af0 remove govendor 2018-12-10 17:16:42 -05:00
Martin Atkins
4fe9632f09 plugin: Establish our current plugin protocol as version 5
The main significant change here is that the package name for the proto
definition is "tfplugin5", which is important because this name is part
of the wire protocol for references to types defined in our package.

Along with that, we also move the generated package into "internal" to
make it explicit that importing the generated Go package from elsewhere is
not the right approach for externally-implemented SDKs, which should
instead vendor the proto definition they are using and generate their
own stubs to ensure that the wire protocol is the only hard dependency
between Terraform Core and plugins.

After this is merged, any provider binaries built against our
helper/schema package will need to be rebuilt so that they use the new
"tfplugin5" package name instead of "proto".

In a future commit we will include more elaborate and organized
documentation on how an external codebase might make use of our RPC
interface definition to implement an SDK, but the primary concern here
is to ensure we have the right wire package name before release.
2018-11-19 09:56:41 -08:00
Martin Atkins
c133de863b build: Update most things for Go 1.11 modules
We're still using vendoring for now until we get _all_ of our tooling
updated, so the main idea here is to force use of the vendor directory
when running tests and building for development so we can quickly find
situations where we forget to run "go mod vendor".

We also setting GO111MODULE=off for installation of tools. Right now this
is the best way to install a tool in GOBIN without also interfering with
go.mod and go.sum, until a better pattern for managing tool dependencies
is devised by the Go team.

Finally, we run "go mod download" before launching "gox" in the main
build process, to prime the local module cache once so that the concurrent
"go build" processes won't race to populate it redundantly. This means
that we'll be producing final builds from the module cache rather than
from vendor as with everything else -- there's currently no way to tell
gox to use -mod=vendor -- but that should be fine in practice since
our go.sum file will ensure that we get the exact sources we expect in
the module cache before building.
2018-11-19 09:02:35 -08:00
Martin Atkins
ec57927ea3 build: Take protoc out of the "go generate" path
Since protoc is not go-gettable, and most development tasks in Terraform
won't involve recompiling protoc files anyway, we'll use a separate
mechanism for these.

This way "go generate" only depends on things we can "go get" in the
"make tools" target.

In a later commit we should also in some way specify a particular version
of protoc to use so that we don't get "flapping" regenerations as
developers work with different versions, but the priority here is just to
make "make generate" minimally usable again to restore the dev workflow
documented in the README.

This also includes some updates that resulted from running "make generate"
and "make protobuf" after those Makefile changes were in place.
2018-10-18 10:39:20 -07:00
Sander van Harmelen
fb0af07696 Print status updates while waiting for the run to start 2018-10-11 13:41:48 +02:00
Radek Simko
c4ffdb1f57
make: Add website + website-test targets 2018-05-02 12:44:17 +01:00
James Bardin
ec62819b3a finish removing vet from the makefile
The test target will already cover vet, since it's run as part of the
test command now.

Also remove the `go test -i` since it's no longer needed with the new
build cache.
2018-02-21 15:30:29 -05:00
James Bardin
3bc1dcf21a update travis to build with go1.10
Remove the vet target too, since vet is now always run with every test.
2018-02-21 11:27:46 -05:00
Martin Atkins
f45aae9b70 build: run end-to-end tests during Travis run
We don't usually run "acceptance tests" during a Travis run, but this
particular suite doesn't require any special credentials since it just
accesses releases.hashicorp.com to download plugins, so therefore it's
safe to run in Travis at the expense of adding a few more seconds to
the runtime.

Running it in Travis can therefore give us some extra confidence for
pull requests that may inadvertently break certain details of the
workflow, as well as ensuring that these tests are kept up-to-date as
the system changes.
2017-09-28 14:35:51 -07:00
Martin Atkins
8cf6756ab7 build: Remove vendor-grepping from Makefile
As of Go 1.9, ./... excludes the vendor directory by default and so we
no longer need to jump through hoops to exclude vendored packages from
testing, vetting, etc.

As a simplification this also re-introduces builtin/bins to the set of
packages we run tests on. With the providers now split into their own
repositories there's far fewer of these and so including them doesn't
really hurt anything, and makes our invocations here simpler.
2017-08-28 09:59:30 -07:00
James Bardin
77a32f3df0 remove "core" distinction
Since there is little left that isn't core, remove the distinction for
now to reduce confusion, since a "core" binary will mostly work except
for provisioners.
2017-06-12 13:43:54 -04:00
James Bardin
1bd0205e49 remove errcheck
The existing harness was only for aws, which fails now that aws is gone.
2017-06-12 13:43:52 -04:00
Christoph Blecker
3f7a117148 build: Fix Travis vet issues (#14010)
* Use latest in go 1.8 branch for travis

* Fix ongoing vet issues
Move vet step after the testing step in travis
Correct Makefile vet step to check correct files
2017-04-27 13:51:22 +12:00
James Bardin
4ef90d803b test changes to travis
Increase timeout to 60s. The consul backend tests come too close to that
and timout every time they stall a little.
2017-03-22 18:04:29 -04:00
Clint
b0deb7736b Makefile: restore test check deps (#12525) 2017-03-09 13:16:25 +02:00
Mitchell Hashimoto
4ed2a563ca
Disallow parallelism in Makefile 2017-02-17 15:31:58 -08:00
James Bardin
87253e448c
install packages for tests
Running `go test -i` installs the requirements for a package's tests.
This way when running the tests in batches of 4, we can cut the runtime
in half be only compiling the dependencies once.
2017-01-26 14:33:50 -08:00
Mitchell Hashimoto
f4ca79d7b7
Update Makefile to run tests 4 packages at a time
We were running out of RAM on Travis
2017-01-26 14:33:50 -08:00
James Bardin
7f6f11b9f2 Add vendor-status make target
Have vendor-status run govendor-status
Add all the missing .PHONY targets
2017-01-20 11:57:23 -05:00
James Bardin
dfb1d9cbe0 fix vet make target to vet all packages
The vet target was only vetting the topmmost packages.
2017-01-13 17:30:46 -05:00
James Nugent
b9f74e388e build: Add test-compile target (#10348) 2016-11-24 16:44:25 +00:00
Clint
740b8bb9cb provider/aws: Run errcheck in tests (#8579)
* provider/aws: Add errcheck to Makefile, error on unchecked errors

* more exceptions

* updates for errcheck to pass

* reformat and spilt out the ignore statements

* narrow down ignores

* fix typo, only ignore Close and Write, instead of close or write
2016-09-02 09:24:17 -05:00
Jake Champlin
8cbef79dbf Allow specifying ldflags via env vars
Allows specifying `LD_FLAGS` during development builds.

```
$ LD_FLAGS="-linkmode=external" make dev
```

Since the version of DTrace on macOS Sierra (On the public beta's at least) has been updated, this allows DTrace to run on Terraform during development/debugging.

```
$ sudo dtrace -n 'pid$target::main.main:entry' -c "terraform apply"
dtrace: description 'pid$target::main.main:entry' matched 1 probe

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

foo = bar
dtrace: pid 23096 has exited
CPU     ID                    FUNCTION:NAME
  2 265673                  main.main:entry
```

Also redirects the `@which stringer` command inside the `generate` Makefile target to `/dev/null` so we stop echoing the path to the `stringer` binary on every call to `generate`.
2016-08-24 10:56:23 -04:00
John Bowler
922e626b7e Fix Makefile for consistency 2016-07-07 11:11:28 -07:00
John Bowler
4a84697b7d Support make test if TF itself is vendored 2016-07-06 19:17:35 -07:00
James Nugent
27d21778a2 build: Allow TESTARGS on make core-test 2016-06-22 16:32:43 +03:00
James Nugent
3593ea8b0a build: Remove format check from plugin-dev
This is intended to reduce cycle time during provider development.
2016-06-11 13:27:08 +01:00
James Nugent
1b011dedf4 build: Skip running tests on /builtin/bins
This is time consuming and spams the output of Travis - to run no tests.
2016-06-11 13:09:19 +01:00
James Nugent
8895b567f4 build: Add tools target to Makefile 2016-06-02 23:22:20 -05:00
Martin Atkins
78a9f8bfb4 build: "make fmt" to ignore vendor packages
Several of our vendered dependencies are not gofmt-compliant, but we don't
want to fix that since the vendored code is supposed to exactly match
upstream.
2016-05-10 15:40:02 -07:00
James Nugent
0c56144d7f build: Only build once for core-dev 2016-05-10 14:49:13 -04:00
Chris Bednarski
6360e6c8b6 Implemented internal plugin calls; which allows us to compile plugins into the main terraform binary 2016-05-10 14:40:11 -04:00
Poney baker
03c64b9ba5 fix(Makefile): remove 'updatedeps' from .PHONY 2016-05-10 14:30:31 +02:00
Martin Atkins
a1530855a3 Build release binaries in release mode
This strips debug information from the binaries, making them slightly
smaller.
2016-04-19 09:50:46 -07:00
James Nugent
9c236e7508 build: Remove gofmt check from core-dev target 2016-04-13 08:40:35 -05:00
Joshua Spence
cfc2890310 Remove TF_QUICKDEV environment variable
This environment variable doesn't seem to be used, the last usage was removed in 6fe2703665.
2016-04-09 21:56:25 +10:00
James Nugent
76f203e7e4 build: Update make core-test for vendoring 2016-03-03 18:08:31 -06:00
Paul Hinze
d21b0897a9 Makefile/docs: Lock in 1.6 req, doc vendored deps
* Drop Go 1.5 compatibility env vars
 * Drop `make updatedeps` from `Makefile` and docs
 * Update README w/ vendored dep instructions
2016-02-24 16:13:49 -06:00
James Nugent
ac957ab329 Run vet target on default target 2016-02-22 13:35:50 -05:00
Trevor Pounds
ebe5346e8f Enable all go vet warnings. 2016-02-17 13:29:51 -08:00
James Nugent
bc6107508d Fix additional vet warnings 2016-02-17 11:59:50 -08:00
Trevor Pounds
3eb65f2cbb Enable go vet -unusedresult check and fix warnings. 2016-02-17 11:59:50 -08:00
Trevor Pounds
79742fc367 Enable go vet -composites check and fix warnings. 2016-02-17 11:59:50 -08:00
Trevor Pounds
8e6d11fc5e Do not go vet vendor dependencies. 2016-02-17 11:59:49 -08:00