2019-01-31 13:31:10 +00:00
|
|
|
version: 2.1
|
|
|
|
|
2019-05-16 13:14:34 +00:00
|
|
|
references:
|
2019-08-13 00:19:58 +00:00
|
|
|
common_envs: &COMMON_ENVS
|
|
|
|
GOMAXPROCS: 1
|
|
|
|
NOMAD_SLOW_TEST: 1
|
|
|
|
GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml
|
2019-08-21 13:56:37 +00:00
|
|
|
ignore_for_ui_branches: &IGNORE_FOR_UI_BRANCHES
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /^.-ui\b.*/
|
|
|
|
|
2019-08-13 00:19:58 +00:00
|
|
|
|
2019-05-16 13:14:34 +00:00
|
|
|
workflows:
|
|
|
|
build-test:
|
|
|
|
jobs:
|
2019-08-21 13:56:37 +00:00
|
|
|
- lint-go:
|
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-client"
|
|
|
|
test_packages: "./client/..."
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-nomad"
|
|
|
|
test_packages: "./nomad/..."
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-08-12 16:48:25 +00:00
|
|
|
- test-machine:
|
|
|
|
# API Tests run in a VM rather than container due to the FS tests
|
|
|
|
# requiring `mount` priviliges.
|
2019-05-16 13:14:34 +00:00
|
|
|
name: "test-api"
|
|
|
|
test_packages: "./api/..."
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-container:
|
|
|
|
name: "test-devices"
|
|
|
|
test_packages: "./devices/..."
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-other"
|
|
|
|
exclude_packages: "./api|./client|./drivers/docker|./drivers/exec|./drivers/rkt|./drivers/shared/executor|./nomad|./devices"
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-docker"
|
|
|
|
test_packages: "./drivers/docker"
|
2019-08-28 12:51:25 +00:00
|
|
|
# docker is misbehaving in docker-machine-recent image
|
|
|
|
# and we get unexpected failures
|
|
|
|
# e.g. https://circleci.com/gh/hashicorp/nomad/3854
|
|
|
|
executor: go-machine
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-exec"
|
|
|
|
test_packages: "./drivers/exec"
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-05-16 13:14:34 +00:00
|
|
|
- test-machine:
|
|
|
|
name: "test-shared-exec"
|
|
|
|
test_packages: "./drivers/shared/executor"
|
2019-08-21 13:56:37 +00:00
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-08-31 14:36:47 +00:00
|
|
|
- test-container:
|
|
|
|
name: "test-32bit-fingerprinting"
|
|
|
|
test_packages: "./client/fingerprint"
|
|
|
|
goarch: "386"
|
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-08-21 13:56:37 +00:00
|
|
|
- test-rkt:
|
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-08-30 11:44:23 +00:00
|
|
|
- test-e2e:
|
|
|
|
<<: *IGNORE_FOR_UI_BRANCHES
|
2019-08-21 13:56:37 +00:00
|
|
|
- test-ui
|
2019-08-30 11:44:23 +00:00
|
|
|
- test-website
|
2019-05-16 13:14:34 +00:00
|
|
|
|
|
|
|
website:
|
|
|
|
jobs:
|
|
|
|
- build-website:
|
|
|
|
context: static-sites
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: stable-website
|
2019-01-31 13:31:10 +00:00
|
|
|
executors:
|
|
|
|
go:
|
2019-08-12 16:34:06 +00:00
|
|
|
working_directory: /go/src/github.com/hashicorp/nomad
|
2019-01-31 13:31:10 +00:00
|
|
|
docker:
|
2019-08-24 01:39:17 +00:00
|
|
|
- image: circleci/golang:1.12.9
|
2019-01-31 13:31:10 +00:00
|
|
|
go-machine:
|
|
|
|
working_directory: ~/go/src/github.com/hashicorp/nomad
|
|
|
|
machine:
|
|
|
|
image: circleci/classic:201808-01
|
|
|
|
docker-builder:
|
|
|
|
working_directory: ~/go/src/github.com/hashicorp/nomad
|
|
|
|
machine: true # TODO: Find latest docker image id
|
|
|
|
|
2019-08-22 14:10:20 +00:00
|
|
|
# uses a more recent image with unattended upgrades disabled properly
|
|
|
|
# but seems to break docker builds
|
|
|
|
go-machine-recent:
|
|
|
|
working_directory: ~/go/src/github.com/hashicorp/nomad
|
|
|
|
machine:
|
|
|
|
image: ubuntu-1604:201903-01
|
|
|
|
|
2018-11-20 21:49:40 +00:00
|
|
|
jobs:
|
2019-01-31 13:31:10 +00:00
|
|
|
build-deps-image:
|
|
|
|
executor: docker-builder
|
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-12 13:30:47 +00:00
|
|
|
- run: docker build -t hashicorpnomad/ci-build-image:$CIRCLE_SHA1 . -f ./Dockerfile.ci
|
|
|
|
- run: docker push hashicorpnomad/ci-build-image:$CIRCLE_SHA1
|
2019-01-31 13:31:10 +00:00
|
|
|
|
2019-08-21 13:56:37 +00:00
|
|
|
lint-go:
|
2019-01-31 13:31:10 +00:00
|
|
|
executor: go
|
|
|
|
environment:
|
2019-08-14 15:23:36 +00:00
|
|
|
<<: *COMMON_ENVS
|
2019-08-12 16:34:06 +00:00
|
|
|
GOPATH: /go
|
2019-01-31 13:31:10 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-24 01:39:17 +00:00
|
|
|
- install-protoc
|
2019-08-30 11:44:23 +00:00
|
|
|
- run: sudo apt-get update && sudo apt-get install shellcheck
|
2019-08-24 01:39:17 +00:00
|
|
|
- run: make deps lint-deps
|
2019-01-31 13:31:10 +00:00
|
|
|
- run: make check
|
2019-08-30 11:44:23 +00:00
|
|
|
- run: make checkscripts
|
2019-01-31 13:31:10 +00:00
|
|
|
|
|
|
|
test-container:
|
|
|
|
executor: go
|
|
|
|
parameters:
|
|
|
|
test_packages:
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
exclude_packages:
|
|
|
|
type: string
|
|
|
|
default: ""
|
2019-08-31 14:36:47 +00:00
|
|
|
goarch:
|
|
|
|
type: string
|
|
|
|
default: "amd64"
|
2019-01-31 13:31:10 +00:00
|
|
|
environment:
|
2019-08-13 00:19:58 +00:00
|
|
|
<<: *COMMON_ENVS
|
2019-01-31 13:31:10 +00:00
|
|
|
GOTEST_PKGS: "<< parameters.test_packages >>"
|
|
|
|
GOTEST_PKGS_EXCLUDE: "<< parameters.exclude_packages >>"
|
2019-08-12 16:34:06 +00:00
|
|
|
GOPATH: /go
|
2019-08-31 14:36:47 +00:00
|
|
|
GOARCH: "<< parameters.goarch >>"
|
2019-01-31 13:31:10 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-24 01:39:17 +00:00
|
|
|
- run: make deps
|
|
|
|
- install-protoc
|
|
|
|
- install-consul
|
|
|
|
- install-vault
|
2019-05-16 13:14:34 +00:00
|
|
|
- run-tests
|
2019-01-31 13:31:10 +00:00
|
|
|
- store_test_results:
|
2019-08-13 00:19:58 +00:00
|
|
|
path: /tmp/test-reports
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/test-reports
|
2019-01-31 13:31:10 +00:00
|
|
|
|
2019-08-30 11:44:23 +00:00
|
|
|
test-e2e:
|
|
|
|
executor: go
|
|
|
|
environment:
|
|
|
|
<<: *COMMON_ENVS
|
|
|
|
GOPATH: /go
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: make deps
|
|
|
|
- run: make e2e-test
|
|
|
|
|
|
|
|
test-website:
|
|
|
|
executor: go-machine-recent
|
|
|
|
environment:
|
|
|
|
<<: *COMMON_ENVS
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: make test-website
|
|
|
|
|
2019-04-17 11:37:16 +00:00
|
|
|
test-rkt:
|
2019-08-22 14:10:20 +00:00
|
|
|
executor: go-machine-recent
|
2019-04-17 11:37:16 +00:00
|
|
|
environment:
|
2019-08-13 00:19:58 +00:00
|
|
|
<<: *COMMON_ENVS
|
2019-04-17 11:37:16 +00:00
|
|
|
GOTEST_PKGS: "./drivers/rkt"
|
|
|
|
GOPATH: /home/circleci/go
|
|
|
|
RKT_VERSION: 1.29.0
|
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-13 00:19:58 +00:00
|
|
|
- install-golang
|
2019-05-16 13:14:34 +00:00
|
|
|
- install-protoc
|
2019-04-17 11:37:16 +00:00
|
|
|
- run:
|
|
|
|
name: install rkt
|
|
|
|
command: |
|
|
|
|
gpg --recv-key 18AD5014C99EF7E3BA5F6CE950BDD3E0FC8A365E
|
|
|
|
wget https://github.com/rkt/rkt/releases/download/v$RKT_VERSION/rkt_$RKT_VERSION-1_amd64.deb
|
|
|
|
wget https://github.com/rkt/rkt/releases/download/v$RKT_VERSION/rkt_$RKT_VERSION-1_amd64.deb.asc
|
|
|
|
gpg --verify rkt_$RKT_VERSION-1_amd64.deb.asc
|
|
|
|
sudo dpkg -i rkt_$RKT_VERSION-1_amd64.deb
|
|
|
|
- run: PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make bootstrap
|
2019-05-16 13:14:34 +00:00
|
|
|
- run-tests
|
2019-04-17 11:37:16 +00:00
|
|
|
- store_test_results:
|
2019-08-13 00:19:58 +00:00
|
|
|
path: /tmp/test-reports
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/test-reports
|
2019-04-17 11:37:16 +00:00
|
|
|
|
2019-01-31 13:31:10 +00:00
|
|
|
test-machine:
|
2019-08-28 12:51:25 +00:00
|
|
|
executor: "<< parameters.executor >>"
|
2019-01-31 13:31:10 +00:00
|
|
|
parameters:
|
|
|
|
test_packages:
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
exclude_packages:
|
|
|
|
type: string
|
|
|
|
default: ""
|
2019-08-28 12:51:25 +00:00
|
|
|
executor:
|
|
|
|
type: string
|
|
|
|
default: "go-machine-recent"
|
2019-01-31 13:31:10 +00:00
|
|
|
environment:
|
2019-08-13 00:19:58 +00:00
|
|
|
<<: *COMMON_ENVS
|
2019-01-31 13:31:10 +00:00
|
|
|
GOTEST_PKGS_EXCLUDE: "<< parameters.exclude_packages >>"
|
|
|
|
GOTEST_PKGS: "<< parameters.test_packages >>"
|
|
|
|
GOPATH: /home/circleci/go
|
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-13 00:19:58 +00:00
|
|
|
- install-golang
|
2019-05-16 13:14:34 +00:00
|
|
|
- install-protoc
|
|
|
|
- install-consul
|
|
|
|
- install-vault
|
2019-01-31 13:31:10 +00:00
|
|
|
- run: PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make bootstrap
|
2019-05-16 13:14:34 +00:00
|
|
|
- run-tests
|
2019-01-31 13:31:10 +00:00
|
|
|
- store_test_results:
|
2019-08-13 00:19:58 +00:00
|
|
|
path: /tmp/test-reports
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/test-reports
|
2019-08-21 13:56:37 +00:00
|
|
|
test-ui:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:10-browsers
|
|
|
|
environment:
|
|
|
|
# See https://git.io/vdao3 for details.
|
|
|
|
JOBS: 2
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- v1-deps-{{ checksum "ui/yarn.lock" }}
|
|
|
|
- v1-deps-
|
|
|
|
- run:
|
|
|
|
name: yarn install
|
|
|
|
command: cd ui && yarn install
|
|
|
|
- save_cache:
|
|
|
|
key: v1-deps-{{ checksum "ui/yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- ./ui/node_modules
|
|
|
|
- run:
|
|
|
|
name: lint:js
|
|
|
|
command: cd ui && yarn run lint:js
|
|
|
|
- run:
|
|
|
|
name: lint:hbs
|
|
|
|
command: cd ui && yarn run lint:hbs
|
|
|
|
- run:
|
|
|
|
name: Ember tests
|
|
|
|
command: cd ui && yarn test
|
2019-01-31 13:31:10 +00:00
|
|
|
|
2018-11-20 21:49:40 +00:00
|
|
|
build-website:
|
|
|
|
# setting the working_directory along with the checkout path allows us to not have
|
|
|
|
# to cd into the website/ directory for commands
|
|
|
|
working_directory: ~/project/website
|
|
|
|
docker:
|
|
|
|
- image: hashicorp/middleman-hashicorp:0.3.35
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
path: ~/project
|
|
|
|
|
|
|
|
# restores gem cache
|
|
|
|
- restore_cache:
|
|
|
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: install gems
|
|
|
|
command: bundle check || bundle install --path vendor/bundle --retry=3
|
|
|
|
|
|
|
|
# saves gem cache if we have changed the Gemfile
|
|
|
|
- save_cache:
|
|
|
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
|
|
|
paths:
|
|
|
|
- ~/project/website/vendor/bundle
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: middleman build
|
|
|
|
command: bundle exec middleman build
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: website deploy
|
|
|
|
command: ./scripts/deploy.sh
|
|
|
|
|
2019-05-16 13:14:34 +00:00
|
|
|
commands:
|
2019-08-13 00:19:58 +00:00
|
|
|
install-golang:
|
2019-08-13 13:22:47 +00:00
|
|
|
parameters:
|
|
|
|
version:
|
|
|
|
type: string
|
2019-08-23 16:26:47 +00:00
|
|
|
default: "1.12.9"
|
2019-08-13 00:19:58 +00:00
|
|
|
steps:
|
|
|
|
- run:
|
2019-08-13 13:22:47 +00:00
|
|
|
name: install golang << parameters.version >>
|
2019-08-13 00:19:58 +00:00
|
|
|
command: |
|
|
|
|
sudo rm -rf /usr/local/go
|
2019-08-13 13:22:47 +00:00
|
|
|
wget -q -O /tmp/golang.tar.gz https://dl.google.com/go/go<< parameters.version >>.linux-amd64.tar.gz
|
|
|
|
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
|
|
|
|
rm -rf /tmp/golang.tar.gz
|
2019-08-13 00:19:58 +00:00
|
|
|
|
2019-05-16 13:14:34 +00:00
|
|
|
install-vault:
|
|
|
|
parameters:
|
|
|
|
version:
|
|
|
|
type: string
|
|
|
|
default: 1.0.0
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install Vault << parameters.version >>
|
|
|
|
command: |
|
2019-08-13 13:22:47 +00:00
|
|
|
wget -q -O /tmp/vault.zip https://releases.hashicorp.com/vault/<< parameters.version >>/vault_<< parameters.version>>_linux_amd64.zip
|
|
|
|
sudo unzip -d /usr/local/bin /tmp/vault.zip
|
|
|
|
rm -rf /tmp/vault*
|
2019-01-31 13:31:10 +00:00
|
|
|
|
2019-05-16 13:14:34 +00:00
|
|
|
install-consul:
|
|
|
|
parameters:
|
|
|
|
version:
|
|
|
|
type: string
|
2019-08-20 20:23:23 +00:00
|
|
|
default: 1.6.0-rc1
|
2019-05-16 13:14:34 +00:00
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install Consul << parameters.version >>
|
|
|
|
command: |
|
2019-08-13 13:22:47 +00:00
|
|
|
wget -q -O /tmp/consul.zip https://releases.hashicorp.com/consul/<< parameters.version >>/consul_<< parameters.version >>_linux_amd64.zip
|
|
|
|
sudo unzip -d /usr/local/bin /tmp/consul.zip
|
|
|
|
rm -rf /tmp/consul*
|
2019-05-16 13:14:34 +00:00
|
|
|
|
|
|
|
install-protoc:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: install protoc
|
|
|
|
command: |
|
|
|
|
sudo rm -rf /usr/bin/protoc
|
2019-05-16 13:19:18 +00:00
|
|
|
sudo ./scripts/vagrant-linux-priv-protoc.sh
|
2019-05-16 13:14:34 +00:00
|
|
|
|
|
|
|
run-tests:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Running Nomad Tests
|
|
|
|
command: |
|
|
|
|
if [ -z $GOTEST_PKGS_EXCLUDE ];
|
|
|
|
then
|
|
|
|
unset GOTEST_PKGS_EXCLUDE
|
|
|
|
else
|
|
|
|
unset GOTEST_PKGS
|
|
|
|
fi
|
|
|
|
|
2019-08-13 00:19:58 +00:00
|
|
|
mkdir -p /tmp/test-reports
|
2019-05-16 13:24:07 +00:00
|
|
|
sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs
|
2019-05-16 13:14:34 +00:00
|
|
|
sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad
|