Commit Graph

120 Commits

Author SHA1 Message Date
Dylan Staley a086f0c1a5 update make website workflow 2021-12-16 16:10:17 -08:00
Alisdair McDiarmid e09bad76ff build: Add exhaustive switch statement lint
For now, only check the JSON views package, since this was the instance
that most recently tripped us up. There are a few dozen failures
elsewhere in Terraform which would need to be addressed before expanding
this to other packages.
2021-09-24 15:12:44 -04:00
James Bardin a3fb07d008 add staticcheck make target
cleanup the old fmtcheck script while we're in here
2021-09-01 11:36:21 -04:00
Martin Atkins ce96d82de0 build: Centralize our protobuf compilation steps
We have a few different .proto files in this repository that all need to
get recompiled into .pb.go files each time we change them, but we were
previously handling that with some scripts that just assumed that protoc
and the relevant plugins were already installed on the system somewhere,
at the right versions.

In practice we've been constantly flopping between different versions of
these tools due to folks having different versions installed in their
development environments. In particular, the state of the .pb.go files
in the prior commit wasn't reproducible by any single version of the tools
because they've all slightly diverged from one another.

In the interests of being more consistent here and avoiding accidental
inconsistencies, we'll now centralize the protocol buffer compile steps
all into a single tool that knows how to fetch and install the expected
versions of the various tools we need and then run those tools with the
right options to get a stable result.

If we want to upgrade to either a newer protoc or a newer protoc-gen-go
in future then we'll do that in a central location and update all of the
.pb.go files at the same time, so that we're always consistently tracking
the same version of protocol buffers everywhere.

While doing this I attempted to keep as close as possible to the toolchain
we'd most recently used, but since they were not consistent with each
other they've now all changed which version numbers they record at minimum,
and the planproto stub in particular now also has a slightly different
descriptor serialization but is otherwise offering the same API.
2021-08-20 16:18:48 -07:00
Martin Atkins d35bc05312 Update various non-code references to renamed Go packages
Previous commits have moved all of our Go packages under "internal", so
this is a retroactive update of non-Go references to those same packages.
2021-05-17 14:09:07 -07:00
Nick Fagerlund bf5522aaec Remove website-test task from Makefile
This task relied on using `wget` to spider the entire site, which is no longer a
useful way of checking for broken links on a non-production instance of
terraform.io. Also, it didn't include a step for pausing until the server came
online, so the task wouldn't have functioned properly anyway.
2021-01-13 17:35:54 -08:00
James Bardin 85b7027048 File no longer exists to be formatted
Were no longer generating the internal plugins list which needs to be
formatted.
2020-12-02 12:45:00 -05:00
James Bardin 8bfbafa790 remove vendor from some tooling 2020-09-23 17:06:59 -04:00
Pam Selle 0eac3de22a Fix missing VERSION for running make website 2020-08-12 13:24:03 -04:00
Alisdair McDiarmid ba374baef0 Makefile: remove unused targets
Most of the targets in the Makefile have not been used in either CI or
the normal development workflow for some time. Removing them clarifies
that the expected way to build Terraform locally is simple: go install.

Remaining targets:

- fmtcheck, generate: these are used in CI to verify that the code is
  correctly formatted and that generate has been run appropriately
- protobuf: referenced in CONTRIBUTING.md as the simplest way to build
  the proto files
- website, website-test: used to compile and test the local website in
  isolation from the terraform-website repo
2020-06-08 07:02:54 -04:00
Pam Selle 9ae266f8fe Coverage updates, roll back makefile change, use travis specific script 2020-03-03 14:10:17 -05:00
Pam Selle 6a4cfa18da Coverage 2020-03-03 13:01:05 -05:00
Kristin Laemmert c72d2c6c44 build: add terraform-bundle e2etests 2019-12-12 09:26:26 -05:00
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