Skip to content

Commit

Permalink
backport of commit 4bf1009
Browse files Browse the repository at this point in the history
  • Loading branch information
davidadeleon committed Jan 19, 2022
1 parent e2d713a commit eb3b011
Show file tree
Hide file tree
Showing 2,414 changed files with 60,396 additions and 116,750 deletions.
245 changes: 97 additions & 148 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .circleci/config/commands/exit-if-ui-or-docs-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
name: Check branch name
command: |
# If the branch being tested starts with ui/ or docs/ we want to exit the job without failing
[[ "$CIRCLE_BRANCH" = ui/* || "$CIRCLE_BRANCH" = docs/* || "$CIRCLE_BRANCH" = backport/docs/* ]] && {
[[ "$CIRCLE_BRANCH" = ui/* || "$CIRCLE_BRANCH" = docs/* ]] && {
# stop the job from this step
circleci-agent step halt
}
Expand Down
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.5"
default: "docker.mirror.hashicorp.services/cimg/go:1.16.12"
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
8 changes: 4 additions & 4 deletions .circleci/config/executors/@executors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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.5 # Pin Go to patch version (ex: 1.2.3)
GO_VERSION: 1.16.12 # Pin Go to patch version (ex: 1.2.3)
GOTESTSUM_VERSION: 0.5.2 # Pin gotestsum to patch version (ex: 1.2.3)
GO_TAGS: ""
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
Expand All @@ -25,23 +25,23 @@ alpine:
docker-env-go-test-remote-docker:
resource_class: medium
docker:
- image: "docker.mirror.hashicorp.services/cimg/go:1.17.5"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.12"
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.5"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.12"
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.5"
- image: "docker.mirror.hashicorp.services/cimg/go:1.16.12"
environment:
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
GO_TAGS: ""
Expand Down
3 changes: 1 addition & 2 deletions .circleci/config/jobs/algolia-index.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
- image: node:14
- image: node:12
steps:
- checkout
- run:
Expand All @@ -10,6 +10,5 @@ steps:
exit 0
fi
cd website/
npm install -g npm@latest
npm install
node scripts/index_search_content.js
12 changes: 12 additions & 0 deletions .circleci/config/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ jobs:
- test-go-race:
requires:
- pre-flight-checks
filters:
branches:
# UI and Docs-only branches should skip go tests
ignore:
- /^docs\/.*/
- /^ui\/.*/
- test-go-race-remote-docker:
requires:
- pre-flight-checks
filters:
branches:
# UI and Docs-only branches should skip go tests
ignore:
- /^docs\/.*/
- /^ui\/.*/
- website-docker-image:
context: vault-docs
filters:
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/backport-docs.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/backport.yml

This file was deleted.

63 changes: 57 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
# Sequence of patterns matched against refs/heads
branches:
# Push events on main branch
- main
# Push events on release/1.8.x branch
- release/1.8.x

env:
PKG_NAME: "vault"
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
matrix:
goos: [ freebsd, windows, netbsd, openbsd, solaris ]
goarch: [ "386", "amd64", "arm" ]
go: [ "1.17.5" ]
go: [ "1.16.12" ]
exclude:
- goos: solaris
goarch: 386
Expand All @@ -69,6 +69,15 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup go tools
env:
GO111MODULE: off
run: |
go get golang.org/x/tools/cmd/goimports
go get github.com/hashicorp/go-bindata
go get github.com/hashicorp/go-bindata/go-bindata
go get github.com/elazarl/go-bindata-assetfs
go get github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
- name: Setup node and yarn
uses: actions/setup-node@v2
with:
Expand All @@ -82,6 +91,14 @@ jobs:
npm rebuild node-sass
yarn --verbose run build
cd ..
- name: Static assets
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go-bindata-assetfs -o bindata_assetfs.go -pkg http -prefix pkg -modtime 1480000000 -tags ui ./pkg/web_ui/...
mkdir -p http && mv bindata_assetfs.go http/
goimports -w http/bindata_assetfs.go
- name: Build
env:
GOOS: ${{ matrix.goos }}
Expand All @@ -103,7 +120,7 @@ jobs:
matrix:
goos: [linux]
goarch: ["arm", "arm64", "386", "amd64"]
go: ["1.17.5"]
go: ["1.16.12"]
fail-fast: true

name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
Expand All @@ -115,6 +132,15 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup go tools
env:
GO111MODULE: off
run: |
go get golang.org/x/tools/cmd/goimports
go get github.com/hashicorp/go-bindata
go get github.com/hashicorp/go-bindata/go-bindata
go get github.com/elazarl/go-bindata-assetfs
go get github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
- name: Setup node and yarn
uses: actions/setup-node@v2
with:
Expand All @@ -128,6 +154,14 @@ jobs:
npm rebuild node-sass
yarn --verbose run build
cd ..
- name: Static assets
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go-bindata-assetfs -o bindata_assetfs.go -pkg http -prefix pkg -modtime 1480000000 -tags ui ./pkg/web_ui/...
mkdir -p http && mv bindata_assetfs.go http/
goimports -w http/bindata_assetfs.go
- name: Build
env:
GOOS: ${{ matrix.goos }}
Expand All @@ -143,7 +177,7 @@ jobs:
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip

- name: Package
uses: hashicorp/actions-packaging-linux@v1.2
uses: hashicorp/actions-packaging-linux@v1
with:
name: ${{ github.event.repository.name }}
description: "Vault is a tool for secrets management, encryption as a service, and privileged access management."
Expand Down Expand Up @@ -180,7 +214,7 @@ jobs:
matrix:
goos: [ darwin ]
goarch: [ "amd64", "arm64" ]
go: [ "1.17.5" ]
go: [ "1.16.12" ]
fail-fast: true
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
steps:
Expand All @@ -190,6 +224,15 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup go tools
env:
GO111MODULE: off
run: |
go get golang.org/x/tools/cmd/goimports
go get github.com/hashicorp/go-bindata
go get github.com/hashicorp/go-bindata/go-bindata
go get github.com/elazarl/go-bindata-assetfs
go get github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
- name: Setup node and yarn
uses: actions/setup-node@v2
with:
Expand All @@ -203,6 +246,14 @@ jobs:
npm rebuild node-sass
yarn --verbose run build
cd ..
- name: Static assets
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go-bindata-assetfs -o bindata_assetfs.go -pkg http -prefix pkg -modtime 1480000000 -tags ui ./pkg/web_ui/...
mkdir -p http && mv bindata_assetfs.go http/
goimports -w http/bindata_assetfs.go
- name: Build
env:
GOOS: ${{ matrix.goos }}
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/changelog-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,9 @@ jobs:
# "Enhancement is not a valid type of changelog entry, but it's a common mistake.
echo "Found invalid type (enhancement) in changelog - did you mean improvement?"
exit 1
elif grep -q ':changes$' $changelog_files; then
echo "Found invalid type (changes) in changelog - did you mean change?"
exit 1
elif grep -q ':bugs$' $changelog_files; then
echo "Found invalid type (bugs) in changelog - did you mean bug?"
exit 1
elif grep -q ':fix$' $changelog_files; then
echo "Found invalid type (fix) in changelog - did you mean bug?"
exit 1
elif ! grep -q '```release-note:' $changelog_files; then
# People often make changelog files like ```changelog:, which is incorrect.
echo "Changelog file did not contain 'release-note' heading - check formatting."
Expand Down
Loading

0 comments on commit eb3b011

Please sign in to comment.