Skip to content

Commit

Permalink
backport of commit 0e8bcc1
Browse files Browse the repository at this point in the history
  • Loading branch information
akshya96 committed Jun 3, 2022
1 parent 1e8004d commit 19df321
Show file tree
Hide file tree
Showing 3,411 changed files with 88,924 additions and 178,229 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
344 changes: 132 additions & 212 deletions .circleci/config.yml

Large diffs are not rendered by default.

53 changes: 19 additions & 34 deletions .circleci/config/commands/go_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters:
default: false
go_image:
type: string
default: "docker.mirror.hashicorp.services/cimg/go:1.17.9"
default: "docker.mirror.hashicorp.services/cimg/go:1.16.15"
use_docker:
type: boolean
default: false
Expand All @@ -38,7 +38,7 @@ steps:
environment:
GOPRIVATE: 'github.com/hashicorp/*'
command: |
set -exo pipefail
set -x
EXTRA_TAGS=
case "<< parameters.extra_flags >>" in
Expand All @@ -58,36 +58,21 @@ steps:
USE_DOCKER=1
<</ parameters.use_docker >>
# Check all directories with a go.mod file
modules=("." "api" "sdk")
all_package_names=""
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# 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.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(< test-list.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 || true)
else
package_names=$(< test-list.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 || true)
fi
# Move back into root directory
popd
# Append the test packages into the global list, if any are found
if [ -n "$package_names" ]; then
all_package_names+=" ${package_names}"
fi
done
# 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
Expand Down Expand Up @@ -163,7 +148,7 @@ steps:
-timeout=60m \
-parallel=20 \
<< parameters.extra_flags >> \
${all_package_names}
${package_names}
else
GOARCH=<< parameters.arch >> \
GOCACHE=<< parameters.cache_dir >> \
Expand All @@ -175,7 +160,7 @@ steps:
-timeout=60m \
-parallel=20 \
<< parameters.extra_flags >> \
${all_package_names}
${package_names}
fi
- when:
Expand Down
14 changes: 0 additions & 14 deletions .circleci/config/commands/setup-semgrep.yml

This file was deleted.

9 changes: 4 additions & 5 deletions .circleci/config/executors/@executors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ go-machine:
shell: /usr/bin/env bash -euo pipefail -c
environment:
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
GO_VERSION: 1.17.9 # Pin Go to patch version (ex: 1.2.3)
GO_VERSION: 1.16.15 # Pin Go to patch version (ex: 1.2.3)
GOTESTSUM_VERSION: 0.5.2 # Pin gotestsum to patch version (ex: 1.2.3)
GOFUMPT_VERSION: 0.2.1 # Pin gofumpt to patch version (ex: 1.2.3)
GO_TAGS: ""
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
node:
Expand All @@ -27,23 +26,23 @@ alpine:
docker-env-go-test-remote-docker:
resource_class: medium
docker:
- image: "docker.mirror.hashicorp.services/cimg/go:1.17.9"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.15"
environment:
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
GO_TAGS: ""
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
docker-env-go-test:
resource_class: large
docker:
- image: "docker.mirror.hashicorp.services/cimg/go:1.17.9"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.15"
environment:
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
GO_TAGS: ""
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
docker-env-go-test-race:
resource_class: xlarge
docker:
- image: "docker.mirror.hashicorp.services/cimg/go:1.17.9"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.15"
environment:
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
GO_TAGS: ""
Expand Down
14 changes: 14 additions & 0 deletions .circleci/config/jobs/algolia-index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docker:
- image: node:12
steps:
- checkout
- run:
name: Push content to Algolia Index
command: |
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vault.git" ]; then
echo "Not Vault OSS Repo, not indexing Algolia"
exit 0
fi
cd website/
npm install
node scripts/index_search_content.js
16 changes: 0 additions & 16 deletions .circleci/config/jobs/fmt.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .circleci/config/jobs/semgrep.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .circleci/config/jobs/website-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
docker:
- image: circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker Image if Necessary
command: |
IMAGE_TAG="$(git rev-list -n1 HEAD -- website/Dockerfile website/package-lock.json)"
echo "Using $IMAGE_TAG"
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vault.git" ]; then
echo "Not Vault OSS Repo, not building website docker image"
elif curl https://hub.docker.com/v2/repositories/hashicorp/vault-website/tags/$IMAGE_TAG -fsL > /dev/null; then
echo "Dependencies have not changed, not building a new website docker image."
else
cd website/
docker build -t hashicorp/vault-website:$IMAGE_TAG .
docker tag hashicorp/vault-website:$IMAGE_TAG hashicorp/vault-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/vault-website
fi
16 changes: 12 additions & 4 deletions .circleci/config/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
jobs:
- pre-flight-checks
- fmt
- install-ui-dependencies:
requires:
- pre-flight-checks
Expand Down Expand Up @@ -38,6 +37,15 @@ jobs:
- test-go-race-remote-docker:
requires:
- pre-flight-checks
- semgrep:
requires:
- pre-flight-checks
- website-docker-image:
context: vault-docs
filters:
branches:
only:
- main
- algolia-index:
context: vault-docs
filters:
branches:
only:
- stable-website
23 changes: 0 additions & 23 deletions .github/workflows/backport.yml

This file was deleted.

0 comments on commit 19df321

Please sign in to comment.