Commit Graph

157 Commits

Author SHA1 Message Date
Mahmood Ali c6f5fd3baa Honor GO_TAGS env-var
Allow honoring `GO_TAGS` environment variable if set.  Currently, users
must set variable as a makefile argument e.g. `make GO_TAGS=ui dev`, and
this allows us to use env-var syntax (e.g. `GO_TAGS=ui make dev`) and
make it convenient to set GO_TAGS globally.
2019-08-13 10:04:45 -04:00
Danielle Lancashire a5bac88aff
Add maketask for manual image builds 2019-08-12 18:42:12 +02:00
Danielle Lancashire f90c9f5214
makefile: Recover verbose handling 2019-08-12 18:41:36 +02:00
Danielle Tomlinson 886486e694
ci: Migrate to CircleCI
This commit provides an initial migration of general testing CI
infrastructure to CircleCI.

It uses CircleCI 2.1 paramereterised jobs to provide two base
configurations: a vm based `test-machine`, and docker based
`test-container`.

Jobs that require root, docker, or other similar features require the
machine based jobs, but others should be ran using the `test-container` package
as they are both cheaper and faster to run.
2019-08-12 18:41:36 +02:00
Mahmood Ali 02a316592c make: always honor GO_TAGS in dev
Our build scripts pass `$(GO_TAGS)` to `-tags` go compile flags, except
for `make dev`, where `$(NOMAD_UI_TAG)` is used.  This change ensures
`make dev` is inline with the rest of makefile targets.

I use the flag primarily to enable the nomad ui using the committed
compiled assets without regenerating them, as I find using stale ui
satisfactory most of the time.
2019-08-02 23:55:52 +08:00
Michael Lange 9594fade9c Also move the make targets to the root 2019-06-19 17:20:13 -07:00
Lang Martin 9cf1c5a74d
Merge pull request #5581 from hashicorp/dev-make-boostrap-git-hooks
Dev make boostrap git hooks
2019-04-30 16:36:10 -04:00
Mahmood Ali 64a45e0e1e check that /api doesn't import internal nomad pkgs 2019-04-28 13:32:26 -04:00
Lang Martin 51f826af60 make bootstrap installs git hooks pre-push by default 2019-04-25 16:54:02 -04:00
Mahmood Ali 922c66df4b release: skip check step when cutting release
`make check` runs very intensive linters that slow and seem to behave
differently on different machines.

Linting is still a part of our CI and we shouldn't be cutting a release
when CI isn't green anyway.
2019-03-21 14:57:03 -04:00
Mahmood Ali 4832c77363 scripts: only shellcheck shell scripts 2019-03-18 08:45:25 -04:00
Mahmood Ali fb55717b0c
Regenerate Proto files (#5421)
Noticed that the protobuf files are out of sync with ones generated by 1.2.0 protoc go plugin.

The cause for these files seem to be related to release processes, e.g. [0.9.0-beta1 preperation](ecec3d38de (diff-da4da188ee496377d456025c2eab4e87)), and [0.9.0-beta3 preperation](b849d84f2f).

This restores the changes to that of the pinned protoc version and fails build if protobuf files are out of sync.  Sample failing Travis job is that of the first commit change: https://travis-ci.org/hashicorp/nomad/jobs/506285085
2019-03-14 10:56:27 -04:00
Alex Dadgar 1bff98612d remove deleting generated code in clean step 2019-01-30 10:55:03 -08:00
Michael Schurter 17a8c6639c Install versioned release of codecgen
Gets us one step closer to a reproducible build. Also removes the unused
vendored version.
2019-01-30 08:00:17 -08:00
Michael Schurter 32fd800583 install specific version of protoc-gen-go 2019-01-30 07:57:40 -08:00
Nick Ethier 204f6d3270
ci: run seperate build jobs for slower packages 2019-01-23 15:39:34 -05:00
Mahmood Ali d696143da7 ci: run checkscripts
`travis.sh` contained some bash-ism despite it being invoked with `sh`.
2019-01-23 10:54:52 -05:00
Danielle Tomlinson 2656f28f08 chore: Setup appveyor for windows test execution 2019-01-17 18:43:13 +01:00
Mahmood Ali 62a7f951c0 remove lxc references 2019-01-08 09:28:20 -05:00
Mahmood Ali 5e2d5ef4c6 ci: use gotestsum for running tests
`gotestsum` has user friendlier output that emits final summary, also it can emit junit xml file for
automated analysis instead of current format that should significantly
ease automated analysis of CI.
2018-12-15 21:41:11 -05:00
Mahmood Ali 6e32113e33 dev: expand ... in go get
workaround a regression in 1.11.3

> We are aware of a functionality regression in "go get" when executed in GOPATH mode on an import path pattern containing "..." (e.g., "go get github.com/golang/pkg/..."), when downloading packages not already present in the GOPATH workspace. This is issue golang.org/issue/29241. It will be resolved in the next minor patch releases, Go 1.11.4 and Go 1.10.7, which we plan to release soon. We apologize for any disruption.
2018-12-14 09:42:23 -05:00
Mahmood Ali 994b9d967c tests: Lower package runtime
Lowering the runtime here to pre 7ca535aa90748caff1522468cc0c4ab672a74abb expectations.

The longest package at the time `client/driver` shrunk significantly,
and now the longest packages take less than 5 minutes.

We do have some long running timed out projects due to a stuck shutdown,
but in completed jobs (though they failed), the longest packages took
less than 5 minutes.  The longest running packages in
https://travis-ci.org/hashicorp/nomad/jobs/464640776 were:

```
FAIL  github.com/hashicorp/nomad/nomad                                   268.089s
ok    github.com/hashicorp/nomad/drivers/docker                          203.903s  coverage:  68.8%   of  statements
ok    github.com/hashicorp/nomad/drivers/rkt                             132.104s  coverage:  65.0%   of  statements
ok    github.com/hashicorp/nomad/api                                     123.193s  coverage:  62.9%   of  statements
ok    github.com/hashicorp/nomad/command/agent                           74.657s   coverage:  72.3%   of  statements
ok    github.com/hashicorp/nomad/command                                 63.592s   coverage:  42.7%   of  statements
```
2018-12-11 09:35:26 -05:00
Danielle Tomlinson 031829c5a9 make: Fix invocation of vault e2e test 2018-11-29 15:37:26 +01:00
Sevag Hanssian 6ab55108b8
webiste -> website 2018-11-19 18:50:42 -08:00
Mahmood Ali 66f4c23848 increase timeout to 30 minutes
nomad/client take very long and exceed 15m sometimes:

In https://travis-ci.org/hashicorp/nomad/jobs/452990197 :

```
panic: test timed out after 15m0s

goroutine 4739 [running]:
testing.(*M).startAlarm.func1()
	/home/travis/.gimme/versions/go1.11.2.linux.amd64/src/testing/testing.go:1296 +0xfd
....
goroutine 4665 [select]:
github.com/hashicorp/nomad/vendor/google.golang.org/grpc.newClientStream.func5(0xc0003dd500, 0xc000420120, 0x2b3f86295588, 0xc000496810)
	/home/travis/gopath/src/github.com/hashicorp/nomad/vendor/google.golang.org/grpc/stream.go:287 +0xd7
created by github.com/hashicorp/nomad/vendor/google.golang.org/grpc.newClientStream
	/home/travis/gopath/src/github.com/hashicorp/nomad/vendor/google.golang.org/grpc/stream.go:286 +0x842
FAIL	github.com/hashicorp/nomad/client/driver	900.036s
```
2018-11-13 10:21:40 -05:00
Alex Dadgar a7c9ba2fa7 seperate struct and proto generation 2018-11-07 11:51:03 -08:00
Alex Dadgar 204ca8230c Device manager
Introduce a device manager that manages the lifecycle of device plugins
on the client. It fingerprints, collects stats, and forwards Reserve
requests to the correct plugin. The manager, also handles device plugins
failing and validates their output.
2018-11-07 10:43:15 -08:00
Chris Baker bd26f885ce docs: added docs website tests using a simple wget --recursive 2018-10-08 14:44:23 -04:00
Alex Dadgar 99c386c076 skip e2e/vault if integration isn't set 2018-09-25 11:29:09 -07:00
Alex Dadgar 5e4da194e3 build nomad in e2e tests 2018-09-19 10:38:20 -07:00
Alex Dadgar 9d85eaa2ab run in matrix 2018-09-19 10:21:57 -07:00
Alex Dadgar 34e704df64 test automation 2018-09-19 10:18:10 -07:00
Michael Schurter cb9663acf2 Add a -race enabled build to Travis
Allow it to fail for now with the goal of making it the default build in
the future.
2018-08-27 14:15:56 -07:00
Chelsea Holland Komlo 457a0c34b3 add dev dependency for generating protobufs 2018-08-06 11:43:24 -04:00
Michael Lange cf11b1f820 Remove phantomjs call from the makefile 2018-06-11 16:22:52 -07:00
Alex Dadgar bcec68d41d Travis tests binary built with generated files 2018-04-26 15:24:53 -07:00
Michael Schurter d687761ebf rkt: test Stats() and always run tests
Remove the NOMAD_TEST_RKT flag as a guard for rkt tests. Still require
Linux, root, and rkt to be installed. Only check for rkt installation
once in hopes of speeding up rkt tests a bit.
2018-04-24 11:05:42 -07:00
Michael Schurter d3650fb2cd test: build with mock_driver by default
`make release` and `make prerelease` set a `release` tag to disable
enabling the `mock_driver`
2018-04-18 14:45:33 -07:00
Michael Lange 6b0498e079 Run yarn silently during make ember-dist 2018-03-20 11:31:35 -07:00
Michael Schurter 86ccdb9115 Fix generating static assets
Broke due to a change in go-bindata-assetfs
2018-03-19 15:52:38 -07:00
Preetha Appan 1fa50d22d3
Disables verbose mode in travis 2018-02-20 18:38:18 -06:00
Preetha Appan 3a31c19c4a
Make tests in travis be verbose 2018-02-14 10:42:57 -06:00
Alex Dadgar 6c82375524 Switches to HashiCorp fork of jteeuwen/go-bindata.
We make a HashiCorp hard fork of the jteeuwen/go-bindata hard fork that
was replaced and diffed the code against a Dec 1, 2015 copy of the
original repository we had as a cross-check of that hard fork.

This replaces references to jteeuwen/go-bindata to point to the
HashiCorp fork.
2018-02-07 09:48:57 -08:00
Michael Lange 4e74096834 Lock down yarn version 2018-01-17 09:02:04 -08:00
Preetha Appan 32f19b563b
Add changelog formatting to make dev 2018-01-03 16:38:41 -06:00
Preetha Appan c674d7de28
Linkify changelog issues 2017-12-12 15:52:58 -06:00
Preetha Appan 61a7606cd4
Changes vendor.json to one dependency per line 2017-12-12 10:30:36 -06:00
Preetha Appan d0fde78aa3
Removes variable value printer 2017-12-06 18:29:25 -06:00
Preetha Appan d162c715d9
Remove newline 2017-12-06 13:36:46 -06:00
Preetha Appan d8ecdd2bf9
Makes tests on travis not run in verbose mode. 2017-12-06 13:30:31 -06:00
Alex Dadgar c3f3f5092c drop gas 2017-12-04 13:07:24 -08:00
Charlie Voiselle 7da73ce878 Makefile typos 2017-11-13 14:57:17 -05:00
Michael Lange 1845fa4711 Make make dev-ui work as expected 2017-11-10 13:27:48 -08:00
Michael Schurter 0cf93cbc14 Fix git commit build flag 2017-11-03 16:01:01 -07:00
Preetha f72b705240
Merge pull request #3477 from hashicorp/verbose_test
Run test with verbose mode and log to a file
2017-11-01 15:02:27 -05:00
Preetha Appan bf33e6b92e Also search for panics and output 10 lines of context around it 2017-11-01 13:53:03 -05:00
Alex Dadgar cc5a4041ec fix tags 2017-10-31 14:52:01 -07:00
Preetha Appan 49d5c534a2 Run test with verbose mode and log to a file 2017-10-31 12:38:29 -05:00
Alex Dadgar 938deab01d document release procedure 2017-10-26 10:08:19 -07:00
Alex Dadgar 68c0d8a77a add static ui assets 2017-10-25 17:01:26 -07:00
Alex Dadgar 17fa2f598e Merge pull request #3435 from hashicorp/f-travis-seperate
seperate linting from testing
2017-10-25 16:31:55 -07:00
Alex Dadgar b335661363 seperate linting from testing 2017-10-24 10:52:26 -07:00
Alex Dadgar 18b759ee6f Build nomad before testing 2017-10-24 09:35:51 -07:00
Alex Dadgar cb0d0ef009 move to consul freeport implementation 2017-10-23 16:51:40 -07:00
Alex Dadgar dbc014b360 Standardize retrieving a free port into a helper package 2017-10-23 16:48:20 -07:00
Alex Dadgar c41c0ea6e8 Only check scripts on linux and don't double lint 2017-10-19 16:49:58 -07:00
Alex Dadgar 5d449804cb check lxc properly 2017-10-19 15:53:19 -07:00
Alex Dadgar 60111b5af7 Spell check website 2017-09-27 11:14:37 -07:00
Alex Dadgar 4173834231 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar bc775861cc fix metalinter checking ui dir 2017-09-19 11:49:34 -05:00
Alex Dadgar e5ec915ac3 sync 2017-09-19 10:08:23 -05:00
James Nugent 12d41dbfe0 build: Lint shell scripts, and make all shell scripts lint cleanly 2017-09-08 19:50:39 -05:00
James Nugent 094fa23df6 build: Rework Vagrant to support multiple OS boxes
This commit reworks the Vagrantfile for Nomad in order to support
straightforward testing on more than one operating system, whilst
retaining the ability to stand up a test cluster running Ubuntu.

The following changes are made:

- Scripts have been extracted from the Vagrantfile into their own shell
  script files, in order that editors lint them.

- All scripts have been edited to lint with no warnings or errors for
  their respective shells.

- Scripts are named according to the operating system and privilege
  level which they run. We prefer to run a whole shell script as root
  versus prefixing (essentially) every command with `sudo` or an
  equivalent.

- The Linux development box has been separated from the test cluster,
  removing some of the more gnarly (and less portable) logic. The Linux
  development box is still primary and autostarts.

- A FreeBSD target has been added. The base box works for both
  Virtualbox and VMWare Fusion.

- A target is added to the GNUmakefile to stand up a test cluster, using
  the default provider, or overriding the provider by setting the PROVIDER
  variable in make:
	- `make testcluster`
	- `make testcluster PROVIDER=vmware_fusion`

- Machines in the test cluster have Avahi configured for zeroconf
  discovery. Each machine can ping each other machine at `hostname.local`
  - for example `nomad-server02.local`, `nomad-client03.local`.
2017-09-08 19:45:38 -05:00
James Nugent 85002aa8c1 build: Add build targets for FreeBSD/amd64 2017-09-08 18:40:26 -05:00
Alex Dadgar f365ee4a9b Fix Windows AMD64 build architecture 2017-09-05 17:23:21 -07:00
Chelsea Holland Komlo 81f6f1be69 add .exe file extensions for windows builds 2017-08-29 19:15:55 +00:00
Alex Dadgar b94d0e4b08 fix zip structure 2017-08-28 22:29:49 -07:00
Alex Dadgar 01e532fe4a fix lxc 2017-08-21 17:43:51 -07:00
Alex Dadgar 2a5f5030d3 remove printing of GOOS for generate 2017-08-21 15:18:24 -07:00
James Nugent 196cdf4e64 build: Replace shell scripts with GNUmakefile
This commit replaces the shell script-driven build process for Nomad
with one based around GNU Make (note we _do_ use GNU-specific
constructs), requiring no additional scripts for common cases of
development. The following targets are implemented:

Per-OS/arch combinations:

    Binaries (Host - Mac OS X):
	pkg/darwin_amd64/nomad

    Binaries (Host - Linux):
	pkg/linux_386/nomad
	pkg/linux_amd64/nomad
	pkg/linux_amd64-lxc/nomad
	pkg/linux_arm/nomad
	pkg/linux_arm64/nomad
	pkg/windows_386/nomad
	pkg/windows_amd64/nomad

    Packages (Host - Mac OS X):
	pkg/darwin_amd64.zip

    Packages (Host - Linux):
	pkg/linux_386.zip
	pkg/linux_amd64.zip
	pkg/linux_amd64-lxc.zip
	pkg/linux_arm.zip
	pkg/linux_arm64.zip
	pkg/windows_386.zip
	pkg/windows_amd64.zip

Phony targets:

	dev - Builds for the current host GOOS/GOARCH (unless overriden
	      in the environment)

	release - Builds all appropriate release packages for the
	          current host GOOS/GOARCH (i.e. Windows and Linux
		  packages on a Linux host, Darwin packages on an OSX
		  host)

	generate - Generate code for the current host architecture using
	           `go generate`.

	test - Runs the Nomad test suite

	clean - Removes build artifacts

	travis - Runs `make test` with the wrapper script to prevent
	         Travis CI from timing out.

	help - Displays usage information about commonly used targets.

Note that there are some semantic differences from the previous version.

1. `generate` is no longer a dependency of `dev` builds. This is because
   it causes a rebuild every time, even when no code has changed, since
   `go generate` does not appear to leave file timestamps alone.
   Regardless, it is insufficient to generate on one host OS - it needs
   to be run on each target to ensure everything is generated correctly.

2. `gofmt` is no longer checked. This should be enabled as a linter once
   the `gofmt -s` refactoring will pass on the whole code base, in order
   to avoid special cased checks versus using go-metalinter.

Example Usages:

Make a development build for the current GOOS/GOARCH:

	make dev

Make release build packages appropriate for the host OS:

	make release

Update generated code for the host OS:

	make generate

Run linting checks:

	make check

Build a specific alternative GOOS/GOARCH/tags combination:

	make pkg/linux_amd64-pkg/nomad
	make pkg/linux_amd64-pkg.zip
2017-08-18 06:29:26 +01:00
Michael Schurter e42f71f787 Revert "Rename GNUMakefile to Makefile"
This reverts commit 9f2ea92877ed655063a5ecf6bb22b7703bc2cea2.
2017-08-03 09:23:53 -07:00
Seth Vargo 940ca5b935
Rename GNUMakefile to Makefile 2017-08-01 21:57:45 -04:00
James Nugent 504d6d0305 build: Remove gox as a tool dependency
gox has not been used since commit 1aec23bb8, so there is no need to
install it during bootstrap.
2017-07-29 16:31:20 -05:00
Alex Dadgar 855c306ded Merge pull request #2442 from jen20/deps-test-vault
build: Add Vault as an external test dependency
2017-03-16 15:10:05 -07:00
James Nugent a2b9901727 build: Add Vault as an external test dependency
Vault is required for the fingerprinting tests but is not currently
installed by the build process. This commit adds a new category of
external tools for test dependencies and `go get`'s them during the
bootstrap.

We also fix the syntax of the Makefile to use tabs throughout.
2017-03-13 17:14:48 -05:00
Michael Schurter 1f6090371b make bin creates a release binary for the host arch
make dev properly copies the binary into bin/ again.

make release still creates binaries for as many archs as possible.

Fixes #2407
2017-03-08 17:42:28 -08:00
Alex Dadgar 36f3788cb7 Fix lint errors 2017-03-02 21:03:05 -08:00
Alex Dadgar 5be806a3df Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Michael Schurter 822424459e Make sed macos compatible
Saves a backup file using a gitignored extension.
2017-01-27 16:08:21 -08:00
Michael Schurter 6a5fa593fa Split dev build into its own script
The dev build is far simpler than the release build, so move it to its
own shell script. This simplifies the release build script slightly as
well at the cost of duplicating the version/tag logic.

Also don't even try to check for LXC if not running on Linux. I don't
think we want to try to support cross-compiling LXC from non-Linux
hosts.
2017-01-27 16:08:21 -08:00
Seth Vargo ca3d62923d
Move to container-based build process 2016-10-21 20:35:18 -07:00
Alex Dadgar e7fa97ae10 Update install of Vault 2016-08-25 14:07:15 -07:00
Diptanu Choudhury 57095f99d2 Instlling the vault binary 2016-08-22 08:49:23 -05:00
Alex Dadgar 0f6e71a3d8 More advance travis timeout circumvention 2016-08-16 21:46:53 -07:00
Kenjiro Nakayama a1765f0297 Add go fmt before running test in Makefile 2016-08-02 10:36:26 +09:00
Diptanu Choudhury 4e0b621ffa Skipping travis tests and not installing rkt on travis 2016-07-11 15:10:09 -06:00
Sean Chittenden 304f895db5
Update the docs for installing from source 2016-06-16 21:42:47 -07:00
Alex Dadgar 60629b7590 remove vet 2016-06-10 18:46:23 -07:00
Sean Chittenden cca7d92c94 Begin using govendor for dependency management 2016-05-04 19:38:37 -07:00
Alex Dadgar 37c5a5b0d5 install qemu on travis 2016-03-24 11:02:18 -07:00