From d09937e41af0a553504bea931a9eedb4de55fac5 Mon Sep 17 00:00:00 2001 From: Michele Date: Mon, 4 May 2020 16:02:15 -0700 Subject: [PATCH 01/13] Move appveyor tests to circle --- .circleci/config.yml | 660 +++++++++++++----- .circleci/config/commands/install-golang.yml | 33 +- .../config/commands/install-gotestsum.yml | 22 + .circleci/config/commands/install-vault.yml | 26 +- .circleci/config/config.yml | 20 +- .../config/jobs/build-darwin-binaries.yml | 1 + .circleci/config/jobs/test-windows.yml | 79 +++ .circleci/config/workflows/build-test.yml | 150 ++-- appveyor.yml | 67 -- drivers/docker/docklog/docker_logger_test.go | 6 +- drivers/docker/driver_test.go | 2 +- drivers/docker/driver_windows_test.go | 3 +- scripts/update_golang_version.sh | 3 - vendor/go.opencensus.io/README.md | 7 +- 14 files changed, 748 insertions(+), 331 deletions(-) create mode 100644 .circleci/config/commands/install-gotestsum.yml create mode 100644 .circleci/config/jobs/test-windows.yml delete mode 100644 appveyor.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 751cc4e29..0b9ebe141 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,8 +13,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./nomad/... @@ -26,18 +26,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -52,10 +59,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -98,8 +120,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./api/... @@ -111,18 +133,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -137,10 +166,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -183,8 +227,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/exec @@ -196,18 +240,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -222,10 +273,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -268,8 +334,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./client/... @@ -281,18 +347,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -307,10 +380,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -344,6 +432,140 @@ jobs: path: /tmp/test-reports - store_artifacts: path: /tmp/test-reports + test-windows: + machine: + image: windows-server-2019-vs2019:stable + working_directory: c:\gopath\src\github.com\hashicorp\nomad + steps: + - run: + command: git config --global core.autocrlf false + - checkout + - run: + command: | + mkdir -p $GOBIN + mkdir -p $GOTESTSUM_PATH + echo "$GOLANG_VERSION" > ~/GOLANG_VERSION.txt + echo "$GOTESTSUM_VERSION" > ~/GOTESTSUM_VERSION.txt + echo "$VAULT_VERSION" > ~/VAULT_VERSION.txt + name: Setup + - restore_cache: + keys: + - win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + - run: + command: | + set -x + + echo installing golang ${GOLANG_VERSION} + + if [[ windows != "windows" ]] + then + sudo rm -rf c:/go + sudo mkdir -p c: + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.tar.gz + sudo tar -C c: -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf c:/go + mkdir -p c: + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o go.zip -d "/c" + fi + fi + name: install golang + - run: + command: go version + - save_cache: + key: win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + paths: + - /go + - run: + command: go version + - run: + command: "set -x \n\nif [[ windows == \"windows\" ]]\nthen\n if [[ ! -f \"c:\\Windows\\gotestsum.exe\" ]]\n then\n echo \"Cache not found, installing gotestsum\"\n curl -SL --fail -o /tmp/gotestsum.tar.gz https://github.com/gotestyourself/gotestsum/releases/download/v\"$GOTESTSUM_VERSION\"/gotestsum_\"$GOTESTSUM_VERSION\"_\"windows\"_amd64.tar.gz\n tar -C \"/c/Windows\" -xzf /tmp/gotestsum.tar.gz\n fi\nfi\n" + name: Install gotestsum + - save_cache: + key: win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + paths: + - c:\Windows\gotestsum.exe + - run: + command: | + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"$VAULT_VERSION"/vault_"$VAULT_VERSION"_"windows"_amd64.zip + + if [[ windows == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ windows == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault + - save_cache: + key: win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + paths: + - c:\Windows\vault.exe + - run: + command: vault version + - run: + command: choco install make + - run: + command: | + export PATH=$PATH:c/gopath/bin + go get -u github.com/kardianos/govendor + go get -u github.com/ugorji/go/codec/codecgen + go get -u github.com/hashicorp/go-bindata/go-bindata + go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs + go get -u github.com/a8m/tree/cmd/tree + go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt + go get -u github.com/golang/protobuf/protoc-gen-go + go get -u gotest.tools/gotestsum + name: Install golang dependencies + - run: + command: | + go build -o $GOBIN\nomad.exe + name: Build nomad + - save_cache: + key: win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + paths: + - c:\Users\circleci\AppData\Local\go-build + - run: + command: | + # Only test docker driver tests for now + gotestsum --format=short-verbose --junitfile $GOTESTSUM_PATH/results.xml github.com/hashicorp/nomad/drivers/docker github.com/hashicorp/nomad/client/lib/fifo github.com/hashicorp/nomad/client/logmon + name: Run tests with gotestsum + - store_test_results: + path: c:\tmp\test-reports + - store_artifacts: + path: c:\tmp\test-reports + environment: + - GOBIN: c:\gopath\bin + - GOLANG_VERSION: 1.14.1 + - GOPATH: c:\gopath + - GOTESTSUM_PATH: c:\tmp\test-reports + - GOTESTSUM_VERSION: 0.4.2 + - VAULT_VERSION: 1.4.1 + resource_class: windows.medium + shell: bash --login -eo pipefail test-shared-exec: machine: image: ubuntu-1604:201903-01 @@ -353,8 +575,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/shared/executor @@ -366,18 +588,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -392,10 +621,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -489,8 +733,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat website-docker-image: @@ -529,8 +773,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: '' @@ -542,18 +786,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -568,10 +819,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -613,8 +879,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./devices/... @@ -639,10 +905,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ -z $GOTEST_PKGS_EXCLUDE ]; @@ -678,18 +959,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf ~/goinstall/go - sudo mkdir -p ~/goinstall - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C ~/goinstall -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ darwin != "windows" ]] + then + sudo rm -rf ~/goinstall/go + sudo mkdir -p ~/goinstall + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.darwin-amd64.tar.gz + sudo tar -C ~/goinstall -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf ~/goinstall/go + mkdir -p ~/goinstall + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.darwin-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: source ${BASH_ENV} && make deps @@ -707,8 +995,8 @@ jobs: - GOLANG_VERSION: 1.14 - GOMAXPROCS: 1 - GOPATH: /Users/distiller/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat test-docker: @@ -720,8 +1008,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/docker @@ -733,18 +1021,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -759,10 +1054,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -804,8 +1114,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GO_TAGS: codegen_generated @@ -854,8 +1164,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat test-32bit: @@ -867,8 +1177,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./client/fingerprint @@ -880,18 +1190,25 @@ jobs: command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf /usr/local/go - sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ linux != "windows" ]] + then + sudo rm -rf /usr/local/go + sudo mkdir -p /usr/local + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip + unzip -o go.zip -d "/c" + fi + fi name: install golang - run: command: | @@ -906,10 +1223,25 @@ jobs: name: Install Consul 1.6.4 - run: command: | - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/1.2.4/vault_1.2.4_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - name: Install Vault 1.2.4 + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + + if [[ linux == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ linux == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi + name: Install Vault - run: command: | if [ ! -z $GOTESTARCH ] && [ $GOTESTARCH == "386" ]; then @@ -1042,6 +1374,12 @@ workflows: ignore: - stable-website - /^docs-.*/ + - test-windows: + filters: + branches: + ignore: + - /^.-ui\b.*/ + - stable-website website: jobs: - website-docker-image: diff --git a/.circleci/config/commands/install-golang.yml b/.circleci/config/commands/install-golang.yml index 4f0771fd7..f003f3859 100644 --- a/.circleci/config/commands/install-golang.yml +++ b/.circleci/config/commands/install-golang.yml @@ -2,22 +2,31 @@ parameters: target_directory: type: string default: /usr/local - + os: + type: string + default: linux steps: - run: name: install golang command: | set -x - os="linux" - if [[ "$OSTYPE" == "darwin"* ]] - then - os="darwin" - fi - echo installing golang ${GOLANG_VERSION} - sudo rm -rf << parameters.target_directory >>/go - sudo mkdir -p << parameters.target_directory >> - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz - sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz - rm -rf /tmp/golang.tar.gz + + if [[ << parameters.os >> != "windows" ]] + then + sudo rm -rf << parameters.target_directory >>/go + sudo mkdir -p << parameters.target_directory >> + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.tar.gz + sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz + rm -rf /tmp/golang.tar.gz + else + if [[ ! -d "c:\go" ]] + then + echo "Cache not found, doing a fresh install of go" + rm -rf << parameters.target_directory >>/go + mkdir -p <> + curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.zip + unzip -o go.zip -d "/c" + fi + fi diff --git a/.circleci/config/commands/install-gotestsum.yml b/.circleci/config/commands/install-gotestsum.yml new file mode 100644 index 000000000..a40f5d137 --- /dev/null +++ b/.circleci/config/commands/install-gotestsum.yml @@ -0,0 +1,22 @@ +parameters: + version: + type: string + default: 0.4.2 + os: + type: string + default: linux +steps: + - run: + name: Install gotestsum + command: | + set -x + + if [[ << parameters.os >> == "windows" ]] + then + if [[ ! -f "c:\Windows\gotestsum.exe" ]] + then + echo "Cache not found, installing gotestsum" + curl -SL --fail -o /tmp/gotestsum.tar.gz https://github.com/gotestyourself/gotestsum/releases/download/v"<< parameters.version >>"/gotestsum_"<< parameters.version >>"_"<< parameters.os >>"_amd64.tar.gz + tar -C "/c/Windows" -xzf /tmp/gotestsum.tar.gz + fi + fi diff --git a/.circleci/config/commands/install-vault.yml b/.circleci/config/commands/install-vault.yml index 264fbb4b0..0eaa1f84a 100644 --- a/.circleci/config/commands/install-vault.yml +++ b/.circleci/config/commands/install-vault.yml @@ -2,10 +2,28 @@ parameters: version: type: string default: 1.2.4 + os: + type: string + default: linux steps: - run: - name: Install Vault << parameters.version >> + name: Install Vault command: | - curl -SL --fail -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* + set -x + + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"<< parameters.version >>"/vault_"<< parameters.version >>"_"<< parameters.os >>"_amd64.zip + + if [[ << parameters.os >> == "linux" ]] + then + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + fi + if [[ << parameters.os >> == "windows" ]] + then + if [[ ! -f "c:\Windows\vault.exe" ]] + then + echo "Cache not found, doing a fresh install of vault" + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* + fi + fi diff --git a/.circleci/config/config.yml b/.circleci/config/config.yml index 45de96c04..fbe37aa30 100644 --- a/.circleci/config/config.yml +++ b/.circleci/config/config.yml @@ -6,13 +6,15 @@ references: circleci/classic:201808-01 go-machine-recent-image: &go_machine_recent_image ubuntu-1604:201903-01 + go-windows-image: &go_windows_image + 'windows-server-2019-vs2019:stable' # common references common_envs: &common_envs GOMAXPROCS: 1 NOMAD_SLOW_TEST: 1 - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json # disable implicit git paging. CircleCI runs commands with in a tty # making git assume it's an interactive session. PAGER: cat @@ -52,3 +54,17 @@ executors: <<: *common_envs GOPATH: /Users/distiller/go GOLANG_VERSION: 1.14 + + go-windows: + machine: + image: *go_windows_image + resource_class: windows.medium + shell: bash --login -eo pipefail + working_directory: c:\gopath\src\github.com\hashicorp\nomad + environment: + GOPATH: c:\gopath + GOBIN: c:\gopath\bin + GOTESTSUM_PATH: c:\tmp\test-reports + GOLANG_VERSION: 1.14.1 + GOTESTSUM_VERSION: 0.4.2 + VAULT_VERSION: 1.4.1 diff --git a/.circleci/config/jobs/build-darwin-binaries.yml b/.circleci/config/jobs/build-darwin-binaries.yml index 8b5b45403..c2f843aa6 100644 --- a/.circleci/config/jobs/build-darwin-binaries.yml +++ b/.circleci/config/jobs/build-darwin-binaries.yml @@ -8,6 +8,7 @@ steps: - install-golang: target_directory: ~/goinstall + os: darwin - run: source ${BASH_ENV} && make deps - run: brew install protobuf - run: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs diff --git a/.circleci/config/jobs/test-windows.yml b/.circleci/config/jobs/test-windows.yml new file mode 100644 index 000000000..8621f961b --- /dev/null +++ b/.circleci/config/jobs/test-windows.yml @@ -0,0 +1,79 @@ +executor: go-windows + +steps: + - run: git config --global core.autocrlf false + - checkout + - run: + name: Setup + command: | + mkdir -p $GOBIN + mkdir -p $GOTESTSUM_PATH + echo "$GOLANG_VERSION" > ~/GOLANG_VERSION.txt + echo "$GOTESTSUM_VERSION" > ~/GOTESTSUM_VERSION.txt + echo "$VAULT_VERSION" > ~/VAULT_VERSION.txt + - restore_cache: + keys: + - win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + - restore_cache: + keys: + - win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + - install-golang: + target_directory: "c:" + os: windows + - run: go version + - save_cache: + key: win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + paths: + - /go + - run: go version + - install-gotestsum: + os: windows + version: $GOTESTSUM_VERSION + - save_cache: + key: win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + paths: + - c:\Windows\gotestsum.exe + - install-vault: + os: windows + version: $VAULT_VERSION + - save_cache: + key: win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + paths: + - c:\Windows\vault.exe + - run: vault version + - run: choco install make + - run: + name: Install golang dependencies + command: | + export PATH=$PATH:c/gopath/bin + go get -u github.com/kardianos/govendor + go get -u github.com/ugorji/go/codec/codecgen + go get -u github.com/hashicorp/go-bindata/go-bindata + go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs + go get -u github.com/a8m/tree/cmd/tree + go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt + go get -u github.com/golang/protobuf/protoc-gen-go + go get -u gotest.tools/gotestsum + - run: + name: Build nomad + command: | + go build -o $GOBIN\nomad.exe + - save_cache: + key: win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + paths: + - c:\Users\circleci\AppData\Local\go-build + - run: + name: Run tests with gotestsum + command: | + # Only test docker driver tests for now + gotestsum --format=short-verbose --junitfile $GOTESTSUM_PATH/results.xml github.com/hashicorp/nomad/drivers/docker github.com/hashicorp/nomad/client/lib/fifo github.com/hashicorp/nomad/client/logmon + - store_test_results: + path: c:\tmp\test-reports + - store_artifacts: + path: c:\tmp\test-reports diff --git a/.circleci/config/workflows/build-test.yml b/.circleci/config/workflows/build-test.yml index 6184f1713..e6557ea44 100644 --- a/.circleci/config/workflows/build-test.yml +++ b/.circleci/config/workflows/build-test.yml @@ -1,75 +1,81 @@ jobs: -- build-binaries: - # almost always build binaries as they may be needed - # for e2e tests - filters: - branches: - ignore: - - stable-website - - /^.-ui\b.*/ -- lint-go: - filters: &backend_branches_filter - branches: - ignore: - - /^.-ui\b.*/ - - /^docs-.*/ - - stable-website + - build-binaries: + # almost always build binaries as they may be needed + # for e2e tests + filters: + branches: + ignore: + - stable-website + - /^.-ui\b.*/ + - lint-go: + filters: &backend_branches_filter + branches: + ignore: + - /^.-ui\b.*/ + - /^docs-.*/ + - stable-website -- build-darwin-binaries: - # almost always build binaries as they may be needed - # for e2e tests - filters: *backend_branches_filter + - build-darwin-binaries: + # almost always build binaries as they may be needed + # for e2e tests + filters: *backend_branches_filter -- test-machine: - name: "test-client" - test_packages: "./client/..." - filters: *backend_branches_filter -- test-machine: - name: "test-nomad" - test_packages: "./nomad/..." - filters: *backend_branches_filter -- test-machine: - # API Tests run in a VM rather than container due to the FS tests - # requiring `mount` priviliges. - name: "test-api" - test_packages: "./api/..." - filters: *backend_branches_filter -- test-container: - name: "test-devices" - test_packages: "./devices/..." - filters: *backend_branches_filter -- test-machine: - name: "test-other" - exclude_packages: "./api|./client|./drivers/docker|./drivers/exec|./drivers/shared/executor|./nomad|./devices" - filters: *backend_branches_filter -- test-machine: - name: "test-docker" - test_packages: "./drivers/docker" - # 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 - filters: *backend_branches_filter -- test-machine: - name: "test-exec" - test_packages: "./drivers/exec" - filters: *backend_branches_filter -- test-machine: - name: "test-shared-exec" - test_packages: "./drivers/shared/executor" - filters: *backend_branches_filter -- test-machine: - name: "test-32bit" - # Currently we only explicitly test fingerprinting on 32bit - # architectures. - test_packages: "./client/fingerprint" - goarch: "386" - filters: *backend_branches_filter -- test-e2e: - filters: *backend_branches_filter -- test-ui: - filters: - branches: - ignore: - - stable-website - - /^docs-.*/ + - test-machine: + name: "test-client" + test_packages: "./client/..." + filters: *backend_branches_filter + - test-machine: + name: "test-nomad" + test_packages: "./nomad/..." + filters: *backend_branches_filter + - test-machine: + # API Tests run in a VM rather than container due to the FS tests + # requiring `mount` priviliges. + name: "test-api" + test_packages: "./api/..." + filters: *backend_branches_filter + - test-container: + name: "test-devices" + test_packages: "./devices/..." + filters: *backend_branches_filter + - test-machine: + name: "test-other" + exclude_packages: "./api|./client|./drivers/docker|./drivers/exec|./drivers/shared/executor|./nomad|./devices" + filters: *backend_branches_filter + - test-machine: + name: "test-docker" + test_packages: "./drivers/docker" + # 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 + filters: *backend_branches_filter + - test-machine: + name: "test-exec" + test_packages: "./drivers/exec" + filters: *backend_branches_filter + - test-machine: + name: "test-shared-exec" + test_packages: "./drivers/shared/executor" + filters: *backend_branches_filter + - test-machine: + name: "test-32bit" + # Currently we only explicitly test fingerprinting on 32bit + # architectures. + test_packages: "./client/fingerprint" + goarch: "386" + filters: *backend_branches_filter + - test-e2e: + filters: *backend_branches_filter + - test-ui: + filters: + branches: + ignore: + - stable-website + - /^docs-.*/ + - test-windows: + filters: + branches: + ignore: + - /^.-ui\b.*/ + - stable-website diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d0b7ca171..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,67 +0,0 @@ -version: "build-{branch}-{build}" -image: Visual Studio 2017 - -clone_folder: c:\gopath\src\github.com\hashicorp\nomad - -branches: - except: - - /^.-ui\b/ - -environment: - GOPATH: c:\gopath - GOBIN: c:\gopath\bin - GOMAXPROCS: 1 - -install: - # do basic docker smoke test, and pull image in preparation for tests - - cmd: docker info - - cmd: docker run --rm dantoml/busybox-windows:08012019 echo hi there - - - cmd: | - cd C:\go - del /F/Q/S *.* > NUL - cd %APPVEYOR_BUILD_FOLDER% - rmdir /Q/S C:\go - - # install the go version used for cutting a release - - cmd: | - mkdir c:\go - appveyor DownloadFile "https://dl.google.com/go/go1.14.1.windows-amd64.zip" -FileName "%TEMP%\\go.zip" - - - ps: Expand-Archive $Env:TEMP\go.zip -DestinationPath C:\ - - - cmd: set PATH=%GOBIN%;c:\go\bin;%PATH% - - cmd: echo %Path% - - cmd: go version - - cmd: go env - - ps: mkdir C:\gopath\bin - - ps: appveyor DownloadFile "https://releases.hashicorp.com/vault/0.10.2/vault_0.10.2_windows_amd64.zip" -FileName "C:\\gopath\\bin\\vault.zip" - - ps: Expand-Archive C:\gopath\bin\vault.zip -DestinationPath C:\gopath\bin - # - ps: appveyor DownloadFile "https://releases.hashicorp.com/consul/1.0.0/consul_1.0.0_windows_amd64.zip" -FileName "C:\\gopath\\bin\\consul.zip" - # - ps: Expand-Archive C:\gopath\bin\consul.zip -DestinationPath C:\gopath\bin - - ps: choco install make - - ps: | - go get -u github.com/kardianos/govendor - go get -u github.com/ugorji/go/codec/codecgen - go get -u github.com/hashicorp/go-bindata/go-bindata - go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs - go get -u github.com/a8m/tree/cmd/tree - go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt - go get -u github.com/golang/protobuf/protoc-gen-go - go get -u gotest.tools/gotestsum -build_script: - - cmd: | - set PATH=%GOPATH%/bin;%PATH% - go build -o %GOPATH%\bin\nomad.exe -test_script: - # only test docker driver tests for now - - cmd: - gotestsum --junitfile results.xml - github.com/hashicorp/nomad/drivers/docker - github.com/hashicorp/nomad/client/lib/fifo - github.com/hashicorp/nomad/client/logmon -# on_finish: -# - ps: | -# Push-AppveyorArtifact (Resolve-Path .\results.xml) -# $wc = New-Object 'System.Net.WebClient' -# $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\results.xml)) diff --git a/drivers/docker/docklog/docker_logger_test.go b/drivers/docker/docklog/docker_logger_test.go index 172f49546..0d1667b79 100644 --- a/drivers/docker/docklog/docker_logger_test.go +++ b/drivers/docker/docklog/docker_logger_test.go @@ -18,9 +18,9 @@ import ( func testContainerDetails() (image string, imageName string, imageTag string) { if runtime.GOOS == "windows" { - return "dantoml/busybox-windows:08012019", - "dantoml/busybox-windows", - "08012019" + return "stefanscherer/busybox-windows:latest", + "stefanscherer/busybox-windows", + "latest" } return "busybox:1", "busybox", "1" diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index deb3d4b2a..fff0d2423 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -455,7 +455,7 @@ func TestDockerDriver_Start_StoppedContainer(t *testing.T) { if runtime.GOOS != "windows" { imageID, err = d.Impl().(*Driver).loadImage(task, &taskCfg, client) } else { - image, lErr := client.InspectImage("dantoml/busybox-windows:08012019") + image, lErr := client.InspectImage("stefanscherer/busybox-windows:latest") err = lErr if image != nil { imageID = image.ID diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index ffec23a5f..29e0f02d7 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -11,8 +11,7 @@ import ( func newTaskConfig(variant string, command []string) TaskConfig { // busyboxImageID is an id of an image containing nanoserver windows and // a busybox exe. - // See https://github.com/dantoml/windows/blob/81cff1ed77729d1fa36721abd6cb6efebff2f8ef/docker/busybox/Dockerfile - busyboxImageID := "dantoml/busybox-windows:08012019" + busyboxImageID := "stefanscherer/busybox-windows:latest" return TaskConfig{ Image: busyboxImageID, diff --git a/scripts/update_golang_version.sh b/scripts/update_golang_version.sh index f281c11ec..3ed80e874 100755 --- a/scripts/update_golang_version.sh +++ b/scripts/update_golang_version.sh @@ -16,9 +16,6 @@ sed -i'' -e "s|GOLANG_VERSION:[ \"]*[.0-9]*\"*|GOLANG_VERSION: ${golang_version} sed -i'' -e "s|\\(golang.org.*version\\) [.0-9]*|\\1 ${golang_version}|g" \ README.md -sed -i'' -e "s|go[.0-9]*.windows-amd64.zip|go${golang_version}.windows-amd64.zip|g" \ - appveyor.yml - sed -i'' -e "s|go_version=\"*[^\"]*\"*$|go_version=\"${golang_version}\"|g" \ scripts/vagrant-linux-priv-go.sh scripts/release/mac-remote-build diff --git a/vendor/go.opencensus.io/README.md b/vendor/go.opencensus.io/README.md index a8cd09eaf..066b81437 100644 --- a/vendor/go.opencensus.io/README.md +++ b/vendor/go.opencensus.io/README.md @@ -1,7 +1,7 @@ # OpenCensus Libraries for Go [![Build Status][travis-image]][travis-url] -[![Windows Build Status][appveyor-image]][appveyor-url] +[![Windows Build Status][circleci-image]][circleci-url] [![GoDoc][godoc-image]][godoc-url] [![Gitter chat][gitter-image]][gitter-url] @@ -242,14 +242,13 @@ release in which the functionality was marked *Deprecated*. [travis-image]: https://travis-ci.org/census-instrumentation/opencensus-go.svg?branch=master [travis-url]: https://travis-ci.org/census-instrumentation/opencensus-go -[appveyor-image]: https://ci.appveyor.com/api/projects/status/vgtt29ps1783ig38?svg=true -[appveyor-url]: https://ci.appveyor.com/project/opencensusgoteam/opencensus-go/branch/master +[circleci-image]: https://circleci.com/gh/hashicorp/nomad/tree/master.svg?style=svg +[circleci-url]: https://circleci.com/gh/hashicorp/nomad/tree/master [godoc-image]: https://godoc.org/go.opencensus.io?status.svg [godoc-url]: https://godoc.org/go.opencensus.io [gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg [gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge - [new-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap [new-replace-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap--Replace From 0d436669a6a9a253e020727dd381b6a4ac5daa2a Mon Sep 17 00:00:00 2001 From: Michele Date: Tue, 5 May 2020 17:02:15 -0700 Subject: [PATCH 02/13] Adding a fix --- .circleci/config.yml | 72 ++++++++++---------- .circleci/config/commands/install-golang.yml | 2 +- .circleci/config/config.yml | 6 +- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0b9ebe141..3a792426c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,8 +13,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./nomad/... @@ -45,7 +45,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -120,8 +120,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./api/... @@ -152,7 +152,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -227,8 +227,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/exec @@ -259,7 +259,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -334,8 +334,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./client/... @@ -366,7 +366,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -483,7 +483,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: go version - save_cache: @@ -575,8 +575,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/shared/executor @@ -607,7 +607,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -733,8 +733,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat website-docker-image: @@ -773,8 +773,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: '' @@ -805,7 +805,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -879,8 +879,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./devices/... @@ -978,7 +978,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: source ${BASH_ENV} && make deps - run: @@ -995,8 +995,8 @@ jobs: - GOLANG_VERSION: 1.14 - GOMAXPROCS: 1 - GOPATH: /Users/distiller/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat test-docker: @@ -1008,8 +1008,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./drivers/docker @@ -1040,7 +1040,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc @@ -1114,8 +1114,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GO_TAGS: codegen_generated @@ -1164,8 +1164,8 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat test-32bit: @@ -1177,8 +1177,8 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go - - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json - - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json + - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - GOTEST_PKGS: ./client/fingerprint @@ -1209,7 +1209,7 @@ jobs: unzip -o go.zip -d "/c" fi fi - name: install golang + name: Install golang - run: command: | sudo rm -rf /usr/bin/protoc diff --git a/.circleci/config/commands/install-golang.yml b/.circleci/config/commands/install-golang.yml index f003f3859..ef807b363 100644 --- a/.circleci/config/commands/install-golang.yml +++ b/.circleci/config/commands/install-golang.yml @@ -7,7 +7,7 @@ parameters: default: linux steps: - run: - name: install golang + name: Install golang command: | set -x diff --git a/.circleci/config/config.yml b/.circleci/config/config.yml index fbe37aa30..3173eba09 100644 --- a/.circleci/config/config.yml +++ b/.circleci/config/config.yml @@ -7,14 +7,14 @@ references: go-machine-recent-image: &go_machine_recent_image ubuntu-1604:201903-01 go-windows-image: &go_windows_image - 'windows-server-2019-vs2019:stable' + windows-server-2019-vs2019:stable # common references common_envs: &common_envs GOMAXPROCS: 1 NOMAD_SLOW_TEST: 1 - GOTESTSUM_JUNITFILE: /tmp/test-reports/nomad/results.xml - GOTESTSUM_JSONFILE: /tmp/test-reports/nomad/testjsonfile.json + GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json # disable implicit git paging. CircleCI runs commands with in a tty # making git assume it's an interactive session. PAGER: cat From d83ee3ba1a6d2948a65b4449d493c4d665a7fcee Mon Sep 17 00:00:00 2001 From: Michele Date: Tue, 5 May 2020 17:32:33 -0700 Subject: [PATCH 03/13] Update cache --- .circleci/config.yml | 16 ++++++++-------- .circleci/config/jobs/test-windows.yml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a792426c..a2c6b517a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -450,16 +450,16 @@ jobs: name: Setup - restore_cache: keys: - - win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + - win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - restore_cache: keys: - - win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + - win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - restore_cache: keys: - - win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + - win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - restore_cache: keys: - - win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + - win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - run: command: | set -x @@ -487,7 +487,7 @@ jobs: - run: command: go version - save_cache: - key: win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + key: win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 paths: - /go - run: @@ -496,7 +496,7 @@ jobs: command: "set -x \n\nif [[ windows == \"windows\" ]]\nthen\n if [[ ! -f \"c:\\Windows\\gotestsum.exe\" ]]\n then\n echo \"Cache not found, installing gotestsum\"\n curl -SL --fail -o /tmp/gotestsum.tar.gz https://github.com/gotestyourself/gotestsum/releases/download/v\"$GOTESTSUM_VERSION\"/gotestsum_\"$GOTESTSUM_VERSION\"_\"windows\"_amd64.tar.gz\n tar -C \"/c/Windows\" -xzf /tmp/gotestsum.tar.gz\n fi\nfi\n" name: Install gotestsum - save_cache: - key: win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + key: win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 paths: - c:\Windows\gotestsum.exe - run: @@ -521,7 +521,7 @@ jobs: fi name: Install Vault - save_cache: - key: win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + key: win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 paths: - c:\Windows\vault.exe - run: @@ -545,7 +545,7 @@ jobs: go build -o $GOBIN\nomad.exe name: Build nomad - save_cache: - key: win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + key: win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 paths: - c:\Users\circleci\AppData\Local\go-build - run: diff --git a/.circleci/config/jobs/test-windows.yml b/.circleci/config/jobs/test-windows.yml index 8621f961b..7b2f18e7a 100644 --- a/.circleci/config/jobs/test-windows.yml +++ b/.circleci/config/jobs/test-windows.yml @@ -13,22 +13,22 @@ steps: echo "$VAULT_VERSION" > ~/VAULT_VERSION.txt - restore_cache: keys: - - win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + - win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - restore_cache: keys: - - win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + - win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - restore_cache: keys: - - win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + - win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - restore_cache: keys: - - win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + - win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - install-golang: target_directory: "c:" os: windows - run: go version - save_cache: - key: win-golang-cache-{{ .Branch }}-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 + key: win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 paths: - /go - run: go version @@ -36,14 +36,14 @@ steps: os: windows version: $GOTESTSUM_VERSION - save_cache: - key: win-gotestsum-cache-{{ .Branch }}-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 + key: win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 paths: - c:\Windows\gotestsum.exe - install-vault: os: windows version: $VAULT_VERSION - save_cache: - key: win-vault-cache-{{ .Branch }}-{{ checksum "~/VAULT_VERSION.txt" }}-v1 + key: win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 paths: - c:\Windows\vault.exe - run: vault version @@ -65,7 +65,7 @@ steps: command: | go build -o $GOBIN\nomad.exe - save_cache: - key: win-gobuild-cache-{{ .Branch }}-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 + key: win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 paths: - c:\Users\circleci\AppData\Local\go-build - run: From f1281d86b39081736a258c5f13629b04d8c82f67 Mon Sep 17 00:00:00 2001 From: Michele Date: Tue, 5 May 2020 17:42:24 -0700 Subject: [PATCH 04/13] Caching test From 0dbd22e260cdd823cfedf60cdb2888ff7102d701 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:19:59 -0400 Subject: [PATCH 05/13] makefile to support windows --- GNUmakefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 34eaca9bc..311faf6f0 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,6 +1,6 @@ SHELL = bash PROJECT_ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) -THIS_OS := $(shell uname) +THIS_OS := $(shell uname | cut -d- -f1) GIT_COMMIT := $(shell git rev-parse HEAD) GIT_DIRTY := $(if $(shell git status --porcelain),+CHANGES) @@ -8,7 +8,7 @@ GIT_DIRTY := $(if $(shell git status --porcelain),+CHANGES) GO_LDFLAGS := "-X github.com/hashicorp/nomad/version.GitCommit=$(GIT_COMMIT)$(GIT_DIRTY)" GO_TAGS ?= codegen_generated -GO_TEST_CMD = $(if $(shell which gotestsum),gotestsum --,go test) +GO_TEST_CMD = $(if $(shell command -v gotestsum 2>/dev/null),gotestsum --,go test) ifeq ($(origin GOTEST_PKGS_EXCLUDE), undefined) GOTEST_PKGS ?= "./..." @@ -18,8 +18,8 @@ endif default: help -ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD Windows)) -$(error Building Nomad is currently only supported on Darwin and Linux.) +ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD Windows MSYS_NT)) +$(error Building Nomad is currently only supported on Darwin and Linux; not $(THIS_OS)) endif # On Linux we build for Linux and Windows @@ -242,8 +242,7 @@ command/job_init.bindata_assetfs.go: command/assets/* .PHONY: vendorfmt vendorfmt: @echo "--> Formatting vendor/vendor.json" - test -x $(GOPATH)/bin/vendorfmt || go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt - vendorfmt + vendorfmt .PHONY: changelogfmt changelogfmt: From 4c679d4c64202cbe06fcd44f75d31fd0d7b4c229 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:20:37 -0400 Subject: [PATCH 06/13] Use a pinned tag of stefanscherer/busybox-windows --- drivers/docker/docklog/docker_logger_test.go | 4 ++-- drivers/docker/driver_test.go | 2 +- drivers/docker/driver_windows_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/docker/docklog/docker_logger_test.go b/drivers/docker/docklog/docker_logger_test.go index 0d1667b79..690815bf1 100644 --- a/drivers/docker/docklog/docker_logger_test.go +++ b/drivers/docker/docklog/docker_logger_test.go @@ -18,9 +18,9 @@ import ( func testContainerDetails() (image string, imageName string, imageTag string) { if runtime.GOOS == "windows" { - return "stefanscherer/busybox-windows:latest", + return "stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b", "stefanscherer/busybox-windows", - "latest" + "sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b" } return "busybox:1", "busybox", "1" diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index fff0d2423..88a387aaf 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -455,7 +455,7 @@ func TestDockerDriver_Start_StoppedContainer(t *testing.T) { if runtime.GOOS != "windows" { imageID, err = d.Impl().(*Driver).loadImage(task, &taskCfg, client) } else { - image, lErr := client.InspectImage("stefanscherer/busybox-windows:latest") + image, lErr := client.InspectImage("stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b") err = lErr if image != nil { imageID = image.ID diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index 29e0f02d7..6cb97698d 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -11,7 +11,7 @@ import ( func newTaskConfig(variant string, command []string) TaskConfig { // busyboxImageID is an id of an image containing nanoserver windows and // a busybox exe. - busyboxImageID := "stefanscherer/busybox-windows:latest" + busyboxImageID := "stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b" return TaskConfig{ Image: busyboxImageID, From f8294f5e2a4699a4f45cc8f78f446420e9adc460 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:22:15 -0400 Subject: [PATCH 07/13] Few Windows CI changes: Always install go and vault: the check may accidentally use the CircleCI pre-installed go version instead of the cached version. Also, always install from sources without caching. Go/vault installation is basically a tarball download. That's equivalent to CirleCI caching without the complexity. These steps don't add much time either. Lastly, infer the OS when downloading tarball to avoid managing them in the job spec. --- .circleci/config.yml | 545 +++++++++--------- .circleci/config/commands/install-golang.yml | 27 +- .circleci/config/commands/install-vault.yml | 28 +- .../config/jobs/build-darwin-binaries.yml | 1 - .circleci/config/jobs/test-windows.yml | 57 +- 5 files changed, 316 insertions(+), 342 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a2c6b517a..f3b5008fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,22 +28,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -61,21 +65,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -135,22 +140,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -168,21 +177,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -242,22 +252,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -275,21 +289,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -349,22 +364,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -382,21 +401,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -444,114 +464,82 @@ jobs: command: | mkdir -p $GOBIN mkdir -p $GOTESTSUM_PATH - echo "$GOLANG_VERSION" > ~/GOLANG_VERSION.txt - echo "$GOTESTSUM_VERSION" > ~/GOTESTSUM_VERSION.txt - echo "$VAULT_VERSION" > ~/VAULT_VERSION.txt name: Setup - - restore_cache: - keys: - - win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - run: command: | set -x echo installing golang ${GOLANG_VERSION} - if [[ windows != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf c:/go sudo mkdir -p c: - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C c: -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf c:/go - mkdir -p c: - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf c:/go + mkdir -p c: + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d c: + rm -rf /tmp/go.zip fi name: Install golang - run: command: go version - - save_cache: - key: win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - paths: - - /go - - run: - command: go version - - run: - command: "set -x \n\nif [[ windows == \"windows\" ]]\nthen\n if [[ ! -f \"c:\\Windows\\gotestsum.exe\" ]]\n then\n echo \"Cache not found, installing gotestsum\"\n curl -SL --fail -o /tmp/gotestsum.tar.gz https://github.com/gotestyourself/gotestsum/releases/download/v\"$GOTESTSUM_VERSION\"/gotestsum_\"$GOTESTSUM_VERSION\"_\"windows\"_amd64.tar.gz\n tar -C \"/c/Windows\" -xzf /tmp/gotestsum.tar.gz\n fi\nfi\n" - name: Install gotestsum - - save_cache: - key: win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - paths: - - c:\Windows\gotestsum.exe - run: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"$VAULT_VERSION"/vault_"$VAULT_VERSION"_"windows"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ windows == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"$VAULT_VERSION"/vault_"$VAULT_VERSION"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ windows == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - - save_cache: - key: win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - paths: - - c:\Windows\vault.exe - run: command: vault version - run: command: choco install make - run: command: | - export PATH=$PATH:c/gopath/bin - go get -u github.com/kardianos/govendor - go get -u github.com/ugorji/go/codec/codecgen - go get -u github.com/hashicorp/go-bindata/go-bindata - go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs - go get -u github.com/a8m/tree/cmd/tree - go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt - go get -u github.com/golang/protobuf/protoc-gen-go - go get -u gotest.tools/gotestsum + export PATH=$PATH:/c/go/bin:/c/gopath/bin + make deps name: Install golang dependencies - run: command: | + export PATH=$PATH:/c/go/bin:/c/gopath/bin go build -o $GOBIN\nomad.exe name: Build nomad - - save_cache: - key: win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - paths: - - c:\Users\circleci\AppData\Local\go-build - run: command: | # Only test docker driver tests for now - gotestsum --format=short-verbose --junitfile $GOTESTSUM_PATH/results.xml github.com/hashicorp/nomad/drivers/docker github.com/hashicorp/nomad/client/lib/fifo github.com/hashicorp/nomad/client/logmon + export PATH=$PATH:/c/go/bin:/c/gopath/bin + gotestsum --format=short-verbose \ + --junitfile $GOTESTSUM_PATH/results.xml \ + github.com/hashicorp/nomad/drivers/docker \ + github.com/hashicorp/nomad/client/lib/fifo \ + github.com/hashicorp/nomad/client/logmon name: Run tests with gotestsum - store_test_results: path: c:\tmp\test-reports @@ -590,22 +578,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -623,21 +615,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -788,22 +781,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -821,21 +818,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -907,21 +905,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -961,22 +960,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ darwin != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf ~/goinstall/go sudo mkdir -p ~/goinstall - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.darwin-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C ~/goinstall -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf ~/goinstall/go - mkdir -p ~/goinstall - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.darwin-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf ~/goinstall/go + mkdir -p ~/goinstall + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d ~/goinstall + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -1023,22 +1026,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -1056,21 +1063,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: @@ -1192,22 +1200,26 @@ jobs: echo installing golang ${GOLANG_VERSION} - if [[ linux != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf /usr/local/go sudo mkdir -p /usr/local - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf /usr/local/go - mkdir -p /usr/local - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf /usr/local/go + mkdir -p /usr/local + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d /usr/local + rm -rf /tmp/go.zip fi name: Install golang - run: @@ -1225,21 +1237,22 @@ jobs: command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"linux"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ linux == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"1.2.4"/vault_"1.2.4"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ linux == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi name: Install Vault - run: diff --git a/.circleci/config/commands/install-golang.yml b/.circleci/config/commands/install-golang.yml index ef807b363..e30134f34 100644 --- a/.circleci/config/commands/install-golang.yml +++ b/.circleci/config/commands/install-golang.yml @@ -2,9 +2,6 @@ parameters: target_directory: type: string default: /usr/local - os: - type: string - default: linux steps: - run: name: Install golang @@ -13,20 +10,24 @@ steps: echo installing golang ${GOLANG_VERSION} - if [[ << parameters.os >> != "windows" ]] + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac + + if [[ "${os}" != "windows" ]] then sudo rm -rf << parameters.target_directory >>/go sudo mkdir -p << parameters.target_directory >> - curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.tar.gz + curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz else - if [[ ! -d "c:\go" ]] - then - echo "Cache not found, doing a fresh install of go" - rm -rf << parameters.target_directory >>/go - mkdir -p <> - curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.zip - unzip -o go.zip -d "/c" - fi + rm -rf << parameters.target_directory >>/go + mkdir -p <> + curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip + unzip -o /tmp/go.zip -d << parameters.target_directory >> + rm -rf /tmp/go.zip fi diff --git a/.circleci/config/commands/install-vault.yml b/.circleci/config/commands/install-vault.yml index 0eaa1f84a..ba325b4c6 100644 --- a/.circleci/config/commands/install-vault.yml +++ b/.circleci/config/commands/install-vault.yml @@ -2,28 +2,26 @@ parameters: version: type: string default: 1.2.4 - os: - type: string - default: linux steps: - run: name: Install Vault command: | set -x - curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"<< parameters.version >>"/vault_"<< parameters.version >>"_"<< parameters.os >>"_amd64.zip + case "${OSTYPE}" in + linux*) os="linux" ;; + darwin*) os="darwin" ;; + msys*) os="windows" ;; + *) echo "unknown os: ${OSTYPE}"; exit 1 ;; + esac - if [[ << parameters.os >> == "linux" ]] - then + curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"<< parameters.version >>"/vault_"<< parameters.version >>"_"${os}"_amd64.zip + + if [[ "${os}" != "windows" ]]; then sudo unzip -d /usr/local/bin /tmp/vault.zip rm -rf /tmp/vault* - fi - if [[ << parameters.os >> == "windows" ]] - then - if [[ ! -f "c:\Windows\vault.exe" ]] - then - echo "Cache not found, doing a fresh install of vault" - unzip /tmp/vault.zip -d "/c/Windows" - rm -rf /tmp/vault* - fi + else + rm -rf c:\Windows\vault.exe + unzip /tmp/vault.zip -d "/c/Windows" + rm -rf /tmp/vault* fi diff --git a/.circleci/config/jobs/build-darwin-binaries.yml b/.circleci/config/jobs/build-darwin-binaries.yml index c2f843aa6..8b5b45403 100644 --- a/.circleci/config/jobs/build-darwin-binaries.yml +++ b/.circleci/config/jobs/build-darwin-binaries.yml @@ -8,7 +8,6 @@ steps: - install-golang: target_directory: ~/goinstall - os: darwin - run: source ${BASH_ENV} && make deps - run: brew install protobuf - run: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs diff --git a/.circleci/config/jobs/test-windows.yml b/.circleci/config/jobs/test-windows.yml index 7b2f18e7a..f7d0c2b94 100644 --- a/.circleci/config/jobs/test-windows.yml +++ b/.circleci/config/jobs/test-windows.yml @@ -8,71 +8,34 @@ steps: command: | mkdir -p $GOBIN mkdir -p $GOTESTSUM_PATH - echo "$GOLANG_VERSION" > ~/GOLANG_VERSION.txt - echo "$GOTESTSUM_VERSION" > ~/GOTESTSUM_VERSION.txt - echo "$VAULT_VERSION" > ~/VAULT_VERSION.txt - - restore_cache: - keys: - - win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - - restore_cache: - keys: - - win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - install-golang: target_directory: "c:" - os: windows - run: go version - - save_cache: - key: win-golang-cache-{{ checksum "~/GOLANG_VERSION.txt" }}-v1 - paths: - - /go - - run: go version - - install-gotestsum: - os: windows - version: $GOTESTSUM_VERSION - - save_cache: - key: win-gotestsum-cache-{{ checksum "~/GOTESTSUM_VERSION.txt" }}-v1 - paths: - - c:\Windows\gotestsum.exe - install-vault: - os: windows version: $VAULT_VERSION - - save_cache: - key: win-vault-cache-{{ checksum "~/VAULT_VERSION.txt" }}-v1 - paths: - - c:\Windows\vault.exe - run: vault version - run: choco install make - run: name: Install golang dependencies command: | - export PATH=$PATH:c/gopath/bin - go get -u github.com/kardianos/govendor - go get -u github.com/ugorji/go/codec/codecgen - go get -u github.com/hashicorp/go-bindata/go-bindata - go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs - go get -u github.com/a8m/tree/cmd/tree - go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt - go get -u github.com/golang/protobuf/protoc-gen-go - go get -u gotest.tools/gotestsum + export PATH=$PATH:/c/go/bin:/c/gopath/bin + make deps - run: name: Build nomad command: | + export PATH=$PATH:/c/go/bin:/c/gopath/bin go build -o $GOBIN\nomad.exe - - save_cache: - key: win-gobuild-cache-{{ checksum "/gopath/src/github.com/hashicorp/nomad/api/go.sum" }}-v1 - paths: - - c:\Users\circleci\AppData\Local\go-build - run: name: Run tests with gotestsum command: | # Only test docker driver tests for now - gotestsum --format=short-verbose --junitfile $GOTESTSUM_PATH/results.xml github.com/hashicorp/nomad/drivers/docker github.com/hashicorp/nomad/client/lib/fifo github.com/hashicorp/nomad/client/logmon + export PATH=$PATH:/c/go/bin:/c/gopath/bin + gotestsum --format=short-verbose \ + --junitfile $GOTESTSUM_PATH/results.xml \ + github.com/hashicorp/nomad/drivers/docker \ + github.com/hashicorp/nomad/client/lib/fifo \ + github.com/hashicorp/nomad/client/logmon + - store_test_results: path: c:\tmp\test-reports - store_artifacts: From 5da83c5085ff03c83118b63fd19c874a0a9b5782 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:33:31 -0400 Subject: [PATCH 08/13] colocate test-windows by darwin target Mostly to ease conflict resolution with Enterprise fork, as Enterprise CI doesn't support windows. --- .circleci/config.yml | 13 +++++++------ .circleci/config/workflows/build-test.yml | 10 ++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3b5008fe..b1061b328 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1311,6 +1311,13 @@ workflows: - /^.-ui\b.*/ - /^docs-.*/ - stable-website + - test-windows: + filters: + branches: + ignore: + - /^.-ui\b.*/ + - /^docs-.*/ + - stable-website - test-client: filters: branches: @@ -1387,12 +1394,6 @@ workflows: ignore: - stable-website - /^docs-.*/ - - test-windows: - filters: - branches: - ignore: - - /^.-ui\b.*/ - - stable-website website: jobs: - website-docker-image: diff --git a/.circleci/config/workflows/build-test.yml b/.circleci/config/workflows/build-test.yml index e6557ea44..edc16ecb7 100644 --- a/.circleci/config/workflows/build-test.yml +++ b/.circleci/config/workflows/build-test.yml @@ -16,8 +16,8 @@ jobs: - stable-website - build-darwin-binaries: - # almost always build binaries as they may be needed - # for e2e tests + filters: *backend_branches_filter + - test-windows: filters: *backend_branches_filter - test-machine: @@ -73,9 +73,3 @@ jobs: ignore: - stable-website - /^docs-.*/ - - test-windows: - filters: - branches: - ignore: - - /^.-ui\b.*/ - - stable-website From a3e30f2d7f20d43d481e52f5e89485427b0638ec Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:45:39 -0400 Subject: [PATCH 09/13] remove unused gotestsum installation script --- .../config/commands/install-gotestsum.yml | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 .circleci/config/commands/install-gotestsum.yml diff --git a/.circleci/config/commands/install-gotestsum.yml b/.circleci/config/commands/install-gotestsum.yml deleted file mode 100644 index a40f5d137..000000000 --- a/.circleci/config/commands/install-gotestsum.yml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: - version: - type: string - default: 0.4.2 - os: - type: string - default: linux -steps: - - run: - name: Install gotestsum - command: | - set -x - - if [[ << parameters.os >> == "windows" ]] - then - if [[ ! -f "c:\Windows\gotestsum.exe" ]] - then - echo "Cache not found, installing gotestsum" - curl -SL --fail -o /tmp/gotestsum.tar.gz https://github.com/gotestyourself/gotestsum/releases/download/v"<< parameters.version >>"/gotestsum_"<< parameters.version >>"_"<< parameters.os >>"_amd64.tar.gz - tar -C "/c/Windows" -xzf /tmp/gotestsum.tar.gz - fi - fi From a6e59eb74868bd402f03307107a82cb9a1874b0e Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:55:22 -0400 Subject: [PATCH 10/13] Use an image managed by nomad account This is a retag of stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b --- drivers/docker/docklog/docker_logger_test.go | 6 +++--- drivers/docker/driver_test.go | 2 +- drivers/docker/driver_windows_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/docker/docklog/docker_logger_test.go b/drivers/docker/docklog/docker_logger_test.go index 690815bf1..012d066fb 100644 --- a/drivers/docker/docklog/docker_logger_test.go +++ b/drivers/docker/docklog/docker_logger_test.go @@ -18,9 +18,9 @@ import ( func testContainerDetails() (image string, imageName string, imageTag string) { if runtime.GOOS == "windows" { - return "stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b", - "stefanscherer/busybox-windows", - "sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b" + return "hashicorpnomad/busybox-windows:server2016-0.1", + "hashicorpnomad/busybox-windows", + "server2016-0.1" } return "busybox:1", "busybox", "1" diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index 88a387aaf..eeee19607 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -455,7 +455,7 @@ func TestDockerDriver_Start_StoppedContainer(t *testing.T) { if runtime.GOOS != "windows" { imageID, err = d.Impl().(*Driver).loadImage(task, &taskCfg, client) } else { - image, lErr := client.InspectImage("stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b") + image, lErr := client.InspectImage("hashicorpnomad/busybox-windows:server2016-0.1") err = lErr if image != nil { imageID = image.ID diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index 6cb97698d..b7b722bb9 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -11,7 +11,7 @@ import ( func newTaskConfig(variant string, command []string) TaskConfig { // busyboxImageID is an id of an image containing nanoserver windows and // a busybox exe. - busyboxImageID := "stefanscherer/busybox-windows@sha256:af396324c4c62e369a388ebb38d4efd44211dc7c95a438e6feb62b4ae4194c5b" + busyboxImageID := "hashicorpnomad/busybox-windows:server2016-0.1" return TaskConfig{ Image: busyboxImageID, From 7ebc3f90c7f7707ae17849fccf9dc7a1ceb64b57 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 12:55:53 -0400 Subject: [PATCH 11/13] Predownload image before tests start --- .circleci/config.yml | 3 +++ .circleci/config/jobs/test-windows.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b1061b328..1a0aadeca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -526,6 +526,9 @@ jobs: export PATH=$PATH:/c/go/bin:/c/gopath/bin make deps name: Install golang dependencies + - run: + command: docker pull hashicorpnomad/busybox-windows:server2016-0.1 + name: Pre-download docker test image - run: command: | export PATH=$PATH:/c/go/bin:/c/gopath/bin diff --git a/.circleci/config/jobs/test-windows.yml b/.circleci/config/jobs/test-windows.yml index f7d0c2b94..40642d46d 100644 --- a/.circleci/config/jobs/test-windows.yml +++ b/.circleci/config/jobs/test-windows.yml @@ -20,6 +20,9 @@ steps: command: | export PATH=$PATH:/c/go/bin:/c/gopath/bin make deps + - run: + name: Pre-download docker test image + command: docker pull hashicorpnomad/busybox-windows:server2016-0.1 - run: name: Build nomad command: | From 8982f749db290be40ab63f2e3d09383046cb1255 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 13:19:21 -0400 Subject: [PATCH 12/13] quiet unzip --- .circleci/config.yml | 20 ++++++++++---------- .circleci/config/commands/install-golang.yml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a0aadeca..2f656dc42 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -158,7 +158,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -270,7 +270,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -382,7 +382,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -489,7 +489,7 @@ jobs: rm -rf c:/go mkdir -p c: curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d c: + unzip -q -o /tmp/go.zip -d c: rm -rf /tmp/go.zip fi name: Install golang @@ -599,7 +599,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -802,7 +802,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -981,7 +981,7 @@ jobs: rm -rf ~/goinstall/go mkdir -p ~/goinstall curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d ~/goinstall + unzip -q -o /tmp/go.zip -d ~/goinstall rm -rf /tmp/go.zip fi name: Install golang @@ -1047,7 +1047,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang @@ -1221,7 +1221,7 @@ jobs: rm -rf /usr/local/go mkdir -p /usr/local curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d /usr/local + unzip -q -o /tmp/go.zip -d /usr/local rm -rf /tmp/go.zip fi name: Install golang diff --git a/.circleci/config/commands/install-golang.yml b/.circleci/config/commands/install-golang.yml index e30134f34..00de89328 100644 --- a/.circleci/config/commands/install-golang.yml +++ b/.circleci/config/commands/install-golang.yml @@ -28,6 +28,6 @@ steps: rm -rf << parameters.target_directory >>/go mkdir -p <> curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip - unzip -o /tmp/go.zip -d << parameters.target_directory >> + unzip -q -o /tmp/go.zip -d << parameters.target_directory >> rm -rf /tmp/go.zip fi From 70e9831e7f09169958b5b0e51b15989c17109f2a Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 15 May 2020 13:36:50 -0400 Subject: [PATCH 13/13] revert vendored file accidental changes [ci skip] --- vendor/go.opencensus.io/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vendor/go.opencensus.io/README.md b/vendor/go.opencensus.io/README.md index 066b81437..a8cd09eaf 100644 --- a/vendor/go.opencensus.io/README.md +++ b/vendor/go.opencensus.io/README.md @@ -1,7 +1,7 @@ # OpenCensus Libraries for Go [![Build Status][travis-image]][travis-url] -[![Windows Build Status][circleci-image]][circleci-url] +[![Windows Build Status][appveyor-image]][appveyor-url] [![GoDoc][godoc-image]][godoc-url] [![Gitter chat][gitter-image]][gitter-url] @@ -242,13 +242,14 @@ release in which the functionality was marked *Deprecated*. [travis-image]: https://travis-ci.org/census-instrumentation/opencensus-go.svg?branch=master [travis-url]: https://travis-ci.org/census-instrumentation/opencensus-go -[circleci-image]: https://circleci.com/gh/hashicorp/nomad/tree/master.svg?style=svg -[circleci-url]: https://circleci.com/gh/hashicorp/nomad/tree/master +[appveyor-image]: https://ci.appveyor.com/api/projects/status/vgtt29ps1783ig38?svg=true +[appveyor-url]: https://ci.appveyor.com/project/opencensusgoteam/opencensus-go/branch/master [godoc-image]: https://godoc.org/go.opencensus.io?status.svg [godoc-url]: https://godoc.org/go.opencensus.io [gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg [gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge + [new-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap [new-replace-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap--Replace