Commit graph

194 commits

Author SHA1 Message Date
Seth Hoenig 889e7ddd0c build: use hashicorp hclfmt
We have been using fatih/hclfmt which is long abandoned. Instead, switch
to HashiCorp's own hclfmt implementation. There are some trivial changes in
behavior around whitespace.
2020-05-24 18:31:57 -05:00
Mahmood Ali 4dc72b6a20 makefile to support windows 2020-05-15 12:19:59 -04:00
Drew Bailey 6f6513ffd3
pin golangci-lint dep to 1.24.0 2020-05-13 10:43:39 -04:00
Mahmood Ali 18dba6fdad Harmonize go-msgpack/codec/codecgen
Use v1.1.5 of go-msgpack/codec/codecgen, so go-msgpack codecgen matches
the library version.

We branched off earlier to pick up
f51b518921
, but apparently that's not needed as we could customize the package via
`-c` argument.
2020-04-28 17:12:31 -04:00
Seth Hoenig f2ef576510 demo: create a demo service for grpc healthchecks
Examples for HTTP based task-group service healthchecks are
covered by the `countdash` demo, but gRPC checks currently
have no runnable examples.

This PR adds a trivial gRPC enabled application that provides
a Service implementing the standard gRPC healthcheck interface.
2020-04-24 10:59:50 -06:00
Tim Gross bad9a82df8
ci: add a linting check for HCL files (#7791)
Running `make dev` runs `hclfmt`, but this isn't checked as part of
CI. That makes it possible to merge un-formatted HCL and Nomad
jobspecs that later will make for dirty git staging areas when
developers pull master.

This changeset adds HCL linting to the `make check` target.
2020-04-23 14:32:44 -04:00
Tim Gross e7e9c83aa3
website: fix path for spellchecking and correct errors (#7790) 2020-04-23 10:38:08 -04:00
Mahmood Ali 030e40ac5c
Merge pull request #7652 from hashicorp/v-gomod-msgpaack
dev: Use go mod for managing hashicorp/go-msgpack
2020-04-08 14:42:39 -04:00
Mahmood Ali 00ea28b0cd go mod for go-bindata
Use go mod for github.com/hashicorp/go-bindata/go-bindata and
github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs but use
`@master` to pull the latest master.  These packages don't have release
tags so `@master` worksaround it.
2020-04-08 14:30:37 -04:00
Tim Gross 457b83a967
build: remove working dir from stack traces (#7653)
Adding `-trimpath` to builds removes the local working directory from
the goroutine stack traces, which makes our builds more reproducible
and doesn't leak information about our local development workstations
or CI environment.
2020-04-07 13:32:07 -04:00
Mahmood Ali 89be4e23c3 dev: Use go mod for managing hashicorp/go-msgpack 2020-04-07 10:52:04 -04:00
Mahmood Ali 5378b557e9 Use latest go-bindata and go-bindata-assetfs
These dep tools aren't tagged properly so shouldn't be installed with go
mod
2020-03-31 20:28:25 -04:00
Mahmood Ali 68462d3553 dev: use go mod to install dev dependencies
This allows using https download and go mod cache proxies, over using
git and downloading entire dependencies git history, hopefully,
resulting into a faster installation process.
2020-03-30 21:32:45 -04:00
Michael Schurter 83890f019d
Merge pull request #7254 from jboero/patch-1
Completed a ppc64le build for testing.
2020-03-19 11:07:20 -07:00
JohnnyB 5e58b434ec
Added s390x and ppc64le
IBM testing.
2020-03-12 13:48:29 +00:00
Mahmood Ali b6f3effc5b ci: add a check for non-vendored packages
This check fails the lint-go CI job if nomad references a package that
is not vendored.
2020-03-09 15:25:00 -04:00
JohnnyB fe46bbd31d
Silly copy pasta tabs vs spaces... 🤦 2020-03-03 13:16:45 +00:00
JohnnyB 9a27fab8b2
Completed a ppc64le build for testing.
Ran into this missing target on ppc64le.  Consul had no issue.
2020-03-03 12:25:21 +00:00
Jeff Escalante b34c5aa187
circle config adjustments 2020-02-06 18:58:07 -05:00
Mahmood Ali fbd1c270f7 make: emit explanation for /api isolation
Emit a slightly helpful message when /api depends on nomad internal
packages.
2020-02-03 12:22:10 -05:00
Lang Martin 4f6a8263ef GNUmakefile: report failed path on hclfmt error 2020-01-10 13:17:14 -05:00
Seth Hoenig 37c7e60cd5 spellcheck: add misspell to linter dependencies
You'd think since golangci-lint embeds misspell we could use that,
but it fails to run if it finds no Go source files, which is the
case in our website/ directory that we want to check.
2019-12-05 19:27:14 -06:00
Danielle Lancashire 0071a06c8b chore: Switch from gometalinter to golangci-lint
gometalinter has been deprecated, with golangci-lint as its spiritual
and recommended successor. Here we switch to using it with an equivalent
configuration, albeit with newer versions of some linters.

To maintain compatibility with existing settings, we have a couple of
things disabled here, specifically:

- tests
        We have a lot of unused code in our tests that choke deadcode.
        We should attempt to clean these up soon so that we can lint our
        testcode.
- govet.check-shadowing = false
        This breaks on redefining `err` which we do all over the nomad
        codebase.
2019-12-05 18:58:13 -06:00
Mahmood Ali 9e211ce16f tests appear as github.com/hashicorp/nomad/api.test 2019-11-12 11:33:20 -05:00
Mahmood Ali e1eb1f6bab api: avoid depending on nomad in test files 2019-11-12 09:32:13 -05:00
Mahmood Ali 4e4a9b252c
Merge pull request #6290 from hashicorp/r-generated-code-refactor
dev: avoid codecgen code in downstream projects
2019-10-15 08:22:31 -04:00
Danielle Lancashire 935c86b404
make: Add make task for formatting HCL 2019-10-11 13:59:22 +02:00
Mahmood Ali 29c8fe1ba1
fix typo
Co-Authored-By: Danielle <dani@hashicorp.com>
2019-09-06 10:05:02 -04:00
Mahmood Ali 01f42053e4 dev: avoid codecgen code in downstream projects
This is an attempt to ease dependency management for external driver
plugins, by avoiding requiring them to compile ugorji/go generated
files.  Plugin developers reported some pain with the brittleness of
ugorji/go dependency in particular, specially when using go mod, the
default go mod manager in golang 1.13.

Context
--------

Nomad uses msgpack to persist and serialize internal structs, using
ugorji/go library.  As an optimization, we use ugorji/go code generation
to speedup process and aovid the relection-based slow path.

We commit these generated files in repository when we cut and tag the
release to ease reproducability and debugging old releases.  Thus,
downstream projects that depend on release tag, indirectly depends on
ugorji/go generated code.

Sadly, the generated code is brittle and specific to the version of
ugorji/go being used.  When go mod picks another version of ugorji/go
then nomad (go mod by default uses release according to semver),
downstream projects face compilation errors.

Interestingly, downstream projects don't commonly serialize nomad
internal structs.  Drivers and device plugins use grpc instead of
msgpack for the most part.  In the few cases where they use msgpag (e.g.
decoding task config), they do without codegen path as they run on
driver specific structs not the nomad internal structs.  Also, the
ugorji/go serialization through reflection is generally backward
compatible (mod some ugorji/go regression bugs that get introduced every
now and then :( ).

Proposal
---------

The proposal here is to keep committing ugorji/go codec generated files
for releases but to use a go tag for them.

All nomad development through the makefile, including releasing, CI and
dev flow, has the tag enabled.

Downstream plugin projects, by default, will skip these files and life
proceed as normal for them.

The downside is that nomad developers who use generated code but avoid
using make must start passing additional go tag argument.  Though this
is not a blessed configuration.
2019-09-06 09:22:00 -04:00
Mahmood Ali 41102260ed ignore nested pkgs in GOTEST_PKGS_EXCLUDE
This fixes a bug where some packages tests run twice in CI, because they
are subpackages of ones with dedicated jobs.  For example, notice
`client/allocrunner` tests ran in `test-client`[1] and `test-other`[2] despite
them being in the same workflow[3].

[1] https://circleci.com/gh/hashicorp/nomad/5262
[2] https://circleci.com/gh/hashicorp/nomad/5261
[3] https://circleci.com/workflow-run/ee7a9167-8fc7-49a5-897c-6c967e966014
2019-09-03 11:04:27 -04:00
Mahmood Ali dfa432eb06 lint: ignore protobuf generated code 2019-09-03 10:59:11 -04:00
Danielle Lancashire bc198d9328
chore: Remove unused travis scripts 2019-08-30 13:51:05 +02:00
Mahmood Ali e17d7338fc use circleci/golang images directly
We currently use an container image for `test-devices` job only; while
all other jobs use machine executor.

This allows us to switch golang and protoc verions easily without
manually managing Docker images (which requires building them manually
on a dev machines, etc).  All that while, we install dependencies on
every build in all other jobs..

`test-devices` now is one of the fastest jobs and isn't a constraint or
a bottleneck, so increasing its overhead by few seconds doesn't hurt the
overall developer iteration.

If we split tests effectively later, we can revisit.
2019-08-23 21:59:49 -04:00
Mahmood Ali c832853436 use a new image with proper protoc dependency
Fixes `test-devices` job
2019-08-23 21:33:07 -04:00
Mahmood Ali 74bc5a2c0b update circleci builds to use golang 1.12.9 2019-08-23 12:26:47 -04:00
Tim Gross 13376cff9c move nomad init outputs to go-bindata assets 2019-08-14 14:10:23 -04:00
Mahmood Ali 422e7bd5a6 Allow per-user local customizations of makefile
Allow users to customize their makefiles by adding custom
targets/variables without checking them in.
2019-08-13 10:12:57 -04:00
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