diff --git a/.circleci/config.yml b/.circleci/config.yml index c4afc008cf..abfe33183f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1700,161 +1700,6 @@ jobs: environment: - CIRCLECI_CLI_VERSION: 0.1.5546 - GO_TAGS: '' - test-go-nightly: - machine: true - shell: /usr/bin/env bash -euo pipefail -c - working_directory: /go/src/github.com/hashicorp/vault - steps: - - run: - command: | - [ -n "$GO_VERSION" ] || { echo "You must set GO_VERSION"; exit 1; } - # Install Go - curl -sSLO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" - sudo rm -rf /usr/local/go - sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" - rm -f "go${GO_VERSION}.linux-amd64.tar.gz" - GOPATH="/go" - mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; } - echo "export GOPATH='$GOPATH'" >> "$BASH_ENV" - echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV" - - echo "$ go version" - go version - name: Setup Go - working_directory: ~/ - - checkout - - run: - command: | - TZ=GMT date '+%Y%m%d' > /tmp/go-cache-key - name: Compute test cache key - - restore_cache: - keys: - - go-test-cache-date-v1-{{ checksum "/tmp/go-cache-key" }} - - run: - command: | - set -x - - EXTRA_TAGS= - case "" in - *-race*) export VAULT_CI_GO_TEST_RACE=1;; - *) EXTRA_TAGS=deadlock;; - esac - - # Install CircleCI CLI - curl -sSL \ - "https://github.com/CircleCI-Public/circleci-cli/releases/download/v${CIRCLECI_CLI_VERSION}/circleci-cli_${CIRCLECI_CLI_VERSION}_linux_amd64.tar.gz" \ - | sudo tar --overwrite -xz \ - -C /usr/local/bin \ - "circleci-cli_${CIRCLECI_CLI_VERSION}_linux_amd64/circleci" - - USE_DOCKER=0 - - # Split Go tests by prior test times. If use_docker is true, only run - # tests that depend on docker, otherwise only those that don't. - if [ $USE_DOCKER == 1 ]; then - package_names=$(go list -test -json ./... | - jq -r 'select(.Deps != null) | - select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | - .ForTest | select(. != null)' | - sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) - else - package_names=$(go list -test -json ./... | - jq -r 'select(.Deps != null) | - select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | - .ForTest | select(. != null)' | - sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) - fi - - # After running tests split step, we are now running the following steps - # in multiple different containers, each getting a different subset of - # the test packages in their package_names variable. Each container - # has its own remote docker VM. - - make prep - mkdir -p test-results/go-test - - # We don't want VAULT_LICENSE set when running Go tests, because that's - # not what developers have in their environments and it could break some - # tests; it would be like setting VAULT_TOKEN. However some non-Go - # CI commands, like the UI tests, shouldn't have to worry about licensing. - # So we set VAULT_LICENSE in CI, and here we unset it. Instead of - # VAULT_LICENSE, we populate VAULT_LICENSE_CI, so that tests which want - # an externally supplied license can opt-in to using it. - export VAULT_LICENSE_CI="$VAULT_LICENSE" - VAULT_LICENSE= - - # Create a docker network for our testcontainer - if [ $USE_DOCKER == 1 ]; then - # Despite the fact that we're using a circleci image (thus getting the - # version they chose for the docker cli) and that we're specifying a - # docker version to use for the remote docker instances, we occasionally - # see "client version too new, max supported version 1.39" errors for - # reasons unclear. - export DOCKER_API_VERSION=1.39 - - export TEST_DOCKER_NETWORK_ID=$(docker network list -q -f 'name=vaulttest') - if [ -z $TEST_DOCKER_NETWORK_ID ]; then - TEST_DOCKER_NETWORK_ID=$(docker network create vaulttest) - fi - - # Start a docker testcontainer to run the tests in - docker run -d -e TEST_DOCKER_NETWORK_ID \ - -e DOCKER_CERT_PATH -e DOCKER_HOST -e DOCKER_MACHINE_NAME -e DOCKER_TLS_VERIFY -e NO_PROXY \ - -e VAULT_TEST_LOG_DIR=/tmp/testlogs \ - --network vaulttest --name \ - testcontainer docker.mirror.hashicorp.services/circleci/golang:1.16.5-buster \ - tail -f /dev/null - - # Run tests - test -d /tmp/go-cache && docker cp /tmp/go-cache testcontainer:/tmp/gocache - docker exec testcontainer sh -c 'mkdir -p /go/src/github.com/hashicorp/vault' - docker cp . testcontainer:/go/src/github.com/hashicorp/vault/ - docker cp $DOCKER_CERT_PATH/ testcontainer:$DOCKER_CERT_PATH - - docker exec -w /go/src/github.com/hashicorp/vault/ \ - -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ - -e VAULT_LICENSE_CI \ - testcontainer \ - gotestsum --format=short-verbose \ - --junitfile test-results/go-test/results.xml \ - --jsonfile test-results/go-test/results.json \ - -- \ - -tags "${GO_TAGS} ${EXTRA_TAGS}" \ - -timeout=60m \ - -parallel=20 \ - \ - ${package_names} - else - GOARCH=amd64 \ - GOCACHE=/tmp/go-cache \ - gotestsum --format=short-verbose \ - --junitfile test-results/go-test/results.xml \ - --jsonfile test-results/go-test/results.json \ - -- \ - -tags "${GO_TAGS} ${EXTRA_TAGS}" \ - -timeout=60m \ - -parallel=20 \ - \ - ${package_names} - fi - name: Run Go tests - no_output_timeout: 60m - - save_cache: - key: go-test-cache-date-v1-{{ checksum "/tmp/go-cache-key" }} - paths: - - /tmp/go-cache - when: always - - store_artifacts: - path: test-results - - store_test_results: - path: test-results - - store_artifacts: - path: /tmp/testlogs - environment: - - CIRCLECI_CLI_VERSION: 0.1.5546 - - GO_TAGS: '' - - GO_VERSION: 1.16.5 - - GOTESTSUM_VERSION: 0.5.2 netbsd_amd64_package: docker: - image: docker.mirror.hashicorp.services/circleci/buildpack-deps @@ -2548,15 +2393,4 @@ workflows: only: - stable-website context: vault-docs - nightly-cachebuilder: - jobs: - - pre-flight-checks - - test-go-nightly - triggers: - - schedule: - cron: 0 9 * * * - filters: - branches: - only: - - master version: 2 diff --git a/.circleci/config/workflows/nightly-cachebuilder.yml b/.circleci/config/workflows/nightly-cachebuilder.yml deleted file mode 100644 index ee7b09c6ef..0000000000 --- a/.circleci/config/workflows/nightly-cachebuilder.yml +++ /dev/null @@ -1,10 +0,0 @@ -triggers: - - schedule: - cron: "0 9 * * *" - filters: - branches: - only: - - master -jobs: - - pre-flight-checks - - test-go-nightly