Commit Graph

216 Commits

Author SHA1 Message Date
Seth Hoenig
2fdb782a0c build: update golangci-lint to v1.46.2
This version of golangci-lint improves support for generics, but also
is more strict in copy vs. loop for slice copying.
2022-05-31 23:32:01 +00:00
Seth Hoenig
04ceba2bfb build: update golang version to 1.18.2
This PR update to Go 1.18.2. Also update the versions of hclfmt
and go-hclogfmt which includes newer dependencies necessary for dealing
with go1.18.

The hcl v2 branch is now 'nomad-v2.9.1+tweaks2', to include a fix for
newer macOS versions: 8927e75e82
2022-05-25 10:04:04 -05:00
hc-github-team-nomad-core
351102bdac Prepare for next release 2022-05-24 16:29:47 -04:00
Luiz Aoqui
3bb3b1b161 prepare for next release (#12956) 2022-05-11 17:42:53 -04:00
Seth Hoenig
894c2e61dd build: use new version of hc-install (#12937)
https://github.com/shoenig/hc-install/pull/2

Uses new version of hc-install which supports the new
json content type reported by api.releases.hashicorp.com
2022-05-10 15:28:29 -04:00
Seth Hoenig
4d404b3958 Merge pull request #12740 from hashicorp/cleanup-makefile-help
build: add missing help descriptions to makefile
2022-05-02 10:33:22 -05:00
Luiz Aoqui
a01e219b1c update LAST_RELEASE comment to match new release branches structure (#12773) 2022-04-25 11:57:55 -04:00
Seth Hoenig
b28c38f02c build: add missing help descriptions to makefile 2022-04-21 14:58:58 -05:00
Seth Hoenig
72a4677415 ci: ensure package coverage of test-core 2022-04-14 19:04:06 -05:00
Luiz Aoqui
a573dec05e ci: make version script match ENT to avoid unnecessary merge conflicts (#12482) 2022-04-06 12:56:52 -04:00
claire labry
0becc4a9b7 [Main] Onboard to CRT (#12276) 2022-04-06 11:47:02 -04:00
Seth Hoenig
8f7f055508 ci: set count to bypass caching 2022-03-25 13:43:33 -05:00
Seth Hoenig
6dd1842560 ci: cleanup verbose mode and enable for gha
test_checks.sh was removed in 2019 and now just breaks if VERBOSE is
set when running tests via make targets

in GHA, use verbose mode to display what tests are running
2022-03-24 15:15:05 -05:00
Seth Hoenig
5c2aa93d6e ci: turn on testing in github actions 2022-03-18 11:12:24 -05:00
Seth Hoenig
a44c55ae84 ci: limit gotestsum to circle ci
Part 2 of breaking up https://github.com/hashicorp/nomad/pull/12255

This PR makes it so gotestsum is invoked only in CircleCI. Also the
HCLogger(t) is plumbed more correctly in TestServer and TestAgent so
that they respect NOMAD_TEST_LOG_LEVEL.

The reason for these is we'll want to disable logging in GHA,
where spamming the disk with logs really drags performance.
2022-03-18 09:15:01 -05:00
Tim Gross
1cb00e8998 CI: increase test run timeout (#12143) 2022-02-28 11:30:59 -05:00
Seth Hoenig
6c7a934033 build: use single-path GOPATH set in makefile
When GOBIN is not set, BIN must be set to the single-path workaround
value of GOPATH, because Circle.
2022-02-17 09:26:13 -06:00
Seth Hoenig
06613d652b build: respect GOBIN when using make targets
This PR updates GNUMakefile to respect $GOBIN if it is set in the
environment or via an $GOENV file. Previously we hard-coded the output
to $GOPATH/bin, which is not necessarily the desired behavior.
2022-02-16 12:05:55 -06:00
Seth Hoenig
9ec605ea83 build: allow golangci-lint to use more than 1 core
Since switching to `golangci-lint` we have set the `-j 1` flag, which
restricts the tool to using 1 CPU thread.

This PR removes the flag so `make check` takes less time on good
computers.
2022-02-14 16:56:58 -06:00
Luiz Aoqui
096934a5a5 prepare for next release 2022-02-10 14:56:11 -05:00
Tim Gross
857d49abf4 prepare for next release 2022-02-01 11:13:22 -05:00
Seth Hoenig
8492c6576e build: upgrade and speedup circleci configuration
This PR upgrades our CI images and fixes some affected tests.

- upgrade go-machine-image to premade latest ubuntu LTS (ubuntu-2004:202111-02)

- eliminate go-machine-recent-image (no longer necessary)

- manage GOPATH in GNUMakefile (see https://discuss.circleci.com/t/gopath-is-set-to-multiple-directories/7174)

- fix tcp dial error check (message seems to be OS specific)

- spot check values measured instead of specifically 'RSS' (rss no longer reported in cgroups v2)

- use safe MkdirTemp for generating tmpfiles

NOT applied: (too flakey)

- eliminate setting GOMAXPROCS=1 (build tools were also affected by this setting)

- upgrade resource type for all imanges to large (2C -> 4C)
2022-01-24 08:28:14 -06:00
Luiz Aoqui
620abba134 prepare for next release 2022-01-19 11:51:59 -05:00
Charlie Voiselle
6e61606eba Make number of scheduler workers reloadable (#11593)
## Development Environment Changes
* Added stringer to build deps

## New HTTP APIs
* Added scheduler worker config API
* Added scheduler worker info API

## New Internals
* (Scheduler)Worker API refactor—Start(), Stop(), Pause(), Resume()
* Update shutdown to use context
* Add mutex for contended server data
    - `workerLock` for the `workers` slice
    - `workerConfigLock` for the `Server.Config.NumSchedulers` and
      `Server.Config.EnabledSchedulers` values

## Other
* Adding docs for scheduler worker api
* Add changelog message

Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>
2022-01-06 11:56:13 -05:00
Tim Gross
a6f6abbbee prepare for next release 2021-12-13 10:14:22 -05:00
Luiz Aoqui
523142d25c prepare for next release 2021-11-24 14:42:09 -05:00
Luiz Aoqui
fcb55e5dac prepare for next release 2021-11-22 10:47:51 -05:00
Luiz Aoqui
23c977c5b2 Merge release 1.2.0 branch (#11513) 2021-11-16 14:16:26 -05:00
Mahmood Ali
c46c530a58 ease building Linux binaries on macOS (#11329)
Meant for development purposes only, so one can compile binary on a
macos host then start a Docker container or scp the binary to a linux
host easily.

The resulting binary is statically linked and has very subtle
differences. e.g. static binaries use go native network stack that
honor /etc/hosts and /etc/resolve differently from the glibc
implementation. In development environment, I don't expect these to
materially change our experience.
2021-10-15 11:12:59 -04:00
Luiz Aoqui
d17b6a2c2b Merge release branch (#11317) 2021-10-14 13:06:04 -04:00
Dave May
bf94aad36f Remove vendor folder during make clean (#11315)
* Remove vendor folder during make clean
* Add vendor warning to make dev build command
2021-10-14 11:32:19 -04:00
Michael Schurter
79c04b816f website: update to 1.1.5
Also update LAST_RELEASE in makefile to 1.1.5
2021-09-20 16:50:37 -07:00
James Rasell
508c259207 Merge pull request #11105 from hashicorp/f-add-staticcheck-ci
ci: add staticcheck with ST1020 and update golangci-lint
2021-09-09 09:42:12 +02:00
Mahmood Ali
cd59172191 Format Terraform files (#11099)
Also format terraform scripts with hclfmt, equivalent to terraform fmt.

I opted not to use terraform fmt, because I didn't want to introduce dev dependency on the terraform CLI.

Also, I've optimized the find command to ignore spurious directories (e.g. .git, node_modules) that seem to be populated with too many files! make hclfmt takes 0.3s on my mac down from 7 seconds!
2021-09-01 15:15:06 -04:00
James Rasell
31cb755ee5 ci: update golangci-lint to v1.42.0 2021-08-31 11:13:31 +02:00
Luiz Aoqui
ff53af3f13 make: embed the Nomad UI data by default (#11018) 2021-08-09 16:53:44 -04:00
Mahmood Ali
04cf47dca2 prepare for next dev cycle 2021-07-29 12:32:09 -04:00
Seth Hoenig
8869c4ddd1 build: no longer use vendor directory
This PR removes the vendor directory from the Nomad repository.
Contributers will no longer need to deal with our `make sync`
step when working on Nomad, which was suprising when making changes
to the api. It also causes huge diffs in PRs that nobody looks at.
2021-07-14 11:13:30 -05:00
Mahmood Ali
18d359f71d Adopt go-changelog in Nomad (#10825)
Adopts [`go-changelog`](https://github.com/hashicorp/go-changelog) for managing Nomad's changelog. `go-changelog` is becoming the HashiCorp defacto standard tool for managing changelog, e.g. [Consul](https://github.com/hashicorp/consul/pull/8387), [Vault](https://github.com/hashicorp/vault/pull/10363), [Waypoint](https://github.com/hashicorp/waypoint/pull/1179). [Consul](https://github.com/hashicorp/consul/pull/8387) seems to be the first product to adopt it, and its PR has the most context - though I've updated `.changelog/README.md` with the relevant info here.

## Changes to developers workflow

When opening PRs, developers should add a changelog entry in `.changelog/<PR#>.txt`. Check [`.changelog/README.md`](https://github.com/hashicorp/nomad/blob/docs-adopt-gochangelog/.changelog/README.md#developer-guide). 

For the WIP release, entries can be amended even after the PR merged, and new files may be added post-hoc (e.g. during transition period, missed accidentally, community PRs, etc).

### Transitioning

Pending PRs can start including the changelog entry files immediately.

For 1.1.3/1.0.9 cycle, the release coordinator should create the entries for any PR that gets merged without a changelog entry file. They should also move any 1.1.3 entry in CHANGELOG.md to a changelog entry file, as this PR done for GH-10818.

## Changes to release process

Before cutting a release, release coordinator should update the changelog by inserting the output of `make changelog` to CHANGELOG.md with appropriate headers. See [`.changelog/README.md`](https://github.com/hashicorp/nomad/blob/docs-adopt-gochangelog/.changelog/README.md#how-to-generate-changelog-entries-for-release) for more details.


## Details

go-changelog is a basic templating engine for maintaining changelog in HashiCorp environment.

It expects the changelog entries as files indexed by their PR number. The CLI generates the changelog section for a release by comparing two git references (e.g. `HEAD` and the latest release, e.g. `v1.1.2`), and still requires manual process for updating CHANGELOG.md and final formatting.

The approach has many nice advantages:
* Avoids changelog related merge conflicts: Each PR touches different file!
* Copes with amendments and post-PR updates: Just add or update a changelog entry file using the original PR numbers.
* Addresses the release backporting scenario: Cherry-picking PRs will cherry-pick the relevant changelog entry automatically!
* Only relies on data available through `git` - no reliance on GitHub metadata or require GitHub credentials

The approach has few downsides though:
* CHANGELOG.md going stale during development and must be updated manually before cutting the release
  * Repository watchers can no longer glance at the CHANGELOG.md to see upcoming changes
  * We can periodically update the file, but `go-changelog` tool does not aid with that
* `go-changelog` tool does not offer good error reporting. If an entry is has an invalid tag (e.g. uses `release-note:bugfix` instead of `release-note:bug`), the entry will be dropped silently
  * We should update go-changelog to warn against unexpected entry tags
  * TODO: Meanwhile, PR reviewers and release coordinators should watch out

## Potential follow ups

We should follow up with CI checks to ensure PR changes include a warning. I've opted not to include that now. We still make many non-changelog-worth PRs for website/docs, for large features that get merged in multiple small PRs. I did not want to include a check that fails often.

Also, we should follow up to have `go-changelog` emit better warnings on unexpected tag.
2021-07-06 10:46:53 -04:00
Mahmood Ali
3d012a1f56 Merge pull request #10296 from hashicorp/c-script-tweaks-20210402
makefile cleanup
2021-04-07 16:54:43 -04:00
Seth Hoenig
c85bbbee70 build: install buf during bootstrap
Previously installing buf was left out of `make bootstrap` because it
had conflicts with the `tools/go.mod` file and dependencies used by
other tools. With Go 1.16 we eliminated that `go.mod` file, and can
now just install `buf` with `go install` like everything else.
2021-04-06 09:42:44 -06:00
Yoan Blanc
a814f0253f chore: bump golangci-lint from v1.24 to v1.39
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2021-04-03 09:50:23 +02:00
Mahmood Ali
caaeaa02f7 Tweak cross compilation Make
Only use cross compile if not compiling in target architecture.

Also, use the latest gcc for cross compilation.
2021-04-02 16:29:57 -04:00
Mahmood Ali
c868444b44 dev: ignore msgpack codegen code in dev by default
This change disables using msgpack generated serializers in dev by
default.

In released binaries, we use code-generated msgpack serializers to
improve performance.  However, in development, code generated
serializers are a pain. If a developer forgets to re-generate code, the
code generated gets out of sync with the go structs, and result into
subtle bugs where some values appear not to persist as expected.

The CI and release scripts will continue to use the msgpack
code-generation. Devs who want to test locally can set
`GO_TAGS=codegen_generated` as well.
2021-04-01 16:27:18 -04:00
Mahmood Ali
bc64f26d6e use go install for tools
Golang 1.16 added better support for installing tools, without updating
go.mod files: https://blog.golang.org/go116-module-changes#TOC_4. .
2021-03-09 14:26:44 -05:00
Mahmood Ali
c9b78e4cfe update buf compare tag to latest release 2021-01-31 20:23:22 -05:00
Mahmood Ali
8a53fdf06d lint: Upgrade buf to 0.36.0, latest so far 2021-01-31 20:09:15 -05:00
Drew Bailey
1d2ac5bbb9 tmp remove darwin arm build (#9786) 2021-01-12 15:52:30 -05:00
Kris Hicks
f4dd0e4aa2 makefile: Set CC explicitly in go build (#9784)
This is required because Go does not pull CC from the make variable. This uses
whatever Go's default CC unless CC is overridden, as it is for the ARM targets.

This also makes it easier to build Nomad on a native ARM device, via:

```
make CC= pkg/linux_arm/nomad
```
2021-01-12 12:09:40 -08:00
Kris Hicks
19d5cd0249 makefile: Re-scope VERBOSE=true, update build warnings (#9675)
* Set 'only' ALL_TARGETS rather than append

This is functionally no different than before, but it's more correct.

* Re-scope VERBOSE=true

Previously this was only set when the OS was Linux; this was added in
805ade7d3.

* Warn about unsupported OS rather than error

Also:

* Only print the warning when trying to build Nomad
* Print correct list of supported OSes
2020-12-18 09:54:14 -08:00