Commit graph

85 commits

Author SHA1 Message Date
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
Jake Champlin c4a3f5047b Include number of allocations in node-status
We recently ran into an issue on a small percentage of nomad-clients
where the nomad-client was running successfully, but due to a race
condition, could not correctly bind to the docker socket. This caused
all of our nomad jobs to be allocated to a single nomad-client instead
of being spread evenly across our clients. The only way to discover this
was to run `nomad node-status <node>` and count each job allocation per
node.

This can lead to a fairly long debugging process if there are several
nomad-clients. Including the number of allocations for each node in the
`node-status` command would save a large amount of debug time.

```
jake@biscuits [12:08:41] [~]
-> % nomad node-status
ID        Datacenter  Name      Class   Drain  Status  Allocations
2b0aabc5  dc1         biscuits  <none>  false  ready   0
```

```
jake@biscuits [12:08:55] [~]
-> % nomad node-status
ID        Datacenter  Name      Class   Drain  Status  Allocations
2b0aabc5  dc1         biscuits  <none>  false  ready   1
```
2016-03-03 12:19:56 -05:00
Abhishek Chanda e1a1b7fc66 Enable running rkt tests in travis
- Introduces a travis target in Makefile to update docker and
  install rkt
2016-03-02 14:04:14 -08:00
Alex Dadgar d6f28ebcb4 Fix import path to be non-vendored in Makefile 2016-02-20 18:59:55 -08:00
Alex Dadgar 1ed9515d4b external dep 2016-02-20 18:22:57 -08:00
Alex Dadgar 2a19e179bc Switch to using go/codec and use code generation 2016-02-20 18:05:17 -08:00
Diptanu Choudhury 35ab48bc3d Fixed the go vet to skip vendored files 2016-02-15 17:56:28 -08:00
Sean Chittenden 89df36b7c7 Rename Makefile to GNUmakefile 2016-02-12 16:59:31 -08:00
Renamed from Makefile (Browse further)