Commit Graph

33 Commits

Author SHA1 Message Date
hc-github-team-secure-vault-core
5fd86cfe55 backport of commit 832c78ee6e (#23672) 2023-10-16 16:39:35 +00:00
Hamid Ghaf
b274630bed adding testonly CI test job (#22439) (#23422)
* adding testonly CI test job

* small instance for testonly tests

* feedback

* shopt

* disable glob expansion

* revert back to a large instance

* fix a mistake
2023-10-09 12:23:55 -07:00
hc-github-team-secure-vault-core
f1da22641d [VAULT-20630] CI: Use 'ref' (not 'base_ref') as a default git reference to check out code in the test-go GHA workflow (#23458) (#23459)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-10-03 17:34:31 +00:00
hc-github-team-secure-vault-core
d34cbbead7 [VAULT-20630] CI: Fix the CI workflow issue where we check out base ref instead of the ref that triggered the workflow run (#23453) (#23454)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-10-03 14:29:04 +01:00
hc-github-team-secure-vault-core
b9e761c862 backport of commit a0217ad017 (#22547)
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2023-08-24 13:14:52 +00:00
hc-github-team-secure-vault-core
6c9bbba75d backport of commit 76d8ab6f43 (#22166)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-08-02 13:49:22 +00:00
hc-github-team-secure-vault-core
d99f9fafa9 backport of commit 437a7ab934 (#22009)
Co-authored-by: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com>
2023-07-21 09:41:53 -07:00
hc-github-team-secure-vault-core
29cc2b2586 [QT-590] Optimize the CI testing workflow (#21959) (#21984)
We further optimize the CI workflow for better costs and speed.
We tested the Go CI workflows across several instance classes
and update our compute choices. We achieve an average execution
speed improvement of 2-2.5 minutes per test workflow while
reducing the infrastructure cost by about 20%. We also also save
another ~2 minutes by installing `gotestsum` from the Github release
instead of downloading the Go modules and compiling it every time.

In addition to the speed improvements, we also further reduced our cache
usage by updating the `security-scan` workflow to not cache Go modules.
We also use the `cache/save` and `cache/restore` actions for timing
caches. This results is saving half as many cache results for timing
data.

*UI test results*
results for 2x runs:
* c6a.2xlarge (12m54s, 11m55s)
* c6a.4xlarge (10m47s, 11m6s)
* c6a.8xlarge (11m32s, 10m51s)
* m5.2xlarge (15m23s, 14m16s)
* m5.4xlarge (14m48s, 12m54s)
* m5.8xlarge (12m27s, 12m24s)
* m6a.2xlarge (11m55s, 12m20s)
* m6a.4xlarge (10m54s, 10m43s)
* m6a.8xlarge (10m33s, 10m51s)

Current runner:
m5.2xlarge (15m23s, 14m16s, avg 14m50s) @ 0.448/hr = $0.11

Faster candidates
* c6a.2xlarge (12m54s, 11m55s, avg 12m24s) @ 0.3816/hr = $0.078
* m6a.2xlarge (11m55s, 12m20s, avg 12m8s) @ 0.4032/hr = $0.081
* c6a.4xlarge (10m47s, 11m6s, avg 10m56s) @ 0.7632/hr = $0.139
* m6a.4xlarge (10m54s, 10m43s, avg 10m48s) @ 0.8064/hr = $0.140

Best bang for the buck for test-ui:
  m6a.2xlarge, > 25% cost savings from current and we save ~2.5 minutes.

*Go test results*
During testing the external replication tests, when not broken up, will
always take the longest. Our original analysis focuses on this job.
Most other tests groups will finish ~3m faster so we'll use subtract
that time when estimating the cost for the whole job.

external replication job results:
* c6a.2xlarge (20m49s, 19m20s, avg 20m5s)
* c6a.4xlarge (19m1s, 19m38s, avg 19m20s)
* c6a.8xlarge (19m51s, 18m54s, avg 19m23s)
* m5.2xlarge (22m12s, 20m29s, avg 21m20s)
* m5.4xlarge (20m7s, 19m3s, avg 20m35s)
* m5.8xlarge (20m24s, 19m42s, avg 20m3s)
* m6a.2xlarge (21m10s, 19m37s, avg 20m23s)
* m6a.4xlarge (18m58s, 19m51s, avg 19m24s)
* m6a.8xlarge (19m27s, 18m47s, avg 19m7s)

There is little separation in time when we increase class size. In the
best case a class size increase yields about a ~5% performance increase
and doubles the cost. For test-go our best bang for the buck is
certainly going to be in the 2xlarge class.

Current runner:
m5.2xlarge (22m12s, 20m29s, avg 21m20s) @ 0.448/hr (16@avg-3m + 1@avg) = $2.35

Candidates in the same class
* c6a.2xlarge (20m49s, 19m20s, avg 20m5s) @ 0.3816/hr (16@avg-3m + 1@avg) = $1.86
* m6a.2xlarge (21m10s, 19m37s, avg 20m23s) @ 0.4032/hr (16@avg-3m + 1@avg) = $2.00

Best bang for the buck for test-go:
  c6a.2xlarge: 20% cost savings and save about ~2.25 minutes.

We ran the tests with similar instances and saw similar execution times as
with test-go. Therefore we can use the same recommended instance sizes.

After breaking up test-go's external replication tests, the longest group
was shorter on average. I choose to look at group 3 as it was usually the
longest grouping:

* c6a.2xlarge: (14m51s, 14m48s)
* c6a.4xlarge: (14m14s, 14m15)
* c6a.8xlarge: (14m0s, 13m54s)
* m5.2xlarge: (15m36s, 15m35s)
* m5.4xlarge: (14m46s, 14m49s)
* m5.8xlarge: (14m25s, 14m25s)
* m6a.2xlarge: 14m51s, 14m53s)
* m6a.4xlarge: 14m16s, 14m16s)
* m6a.8xlarge: (14m2s, 13m57s)

Again, we see ~5% performance gains between the 2x and 8x instance classes
at quadruple the cost. The c6a and m6a families are almost identical, with
the c6a class being cheaper.

*Notes*
* UI and Go Test timing results: https://github.com/hashicorp/vault-enterprise/actions/runs/5556957460/jobs/10150759959
* Go Test with data race detection timing results: https://github.com/hashicorp/vault-enterprise/actions/runs/5558013192
* Go Test with replication broken up: https://github.com/hashicorp/vault-enterprise/actions/runs/5558490899

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-07-20 16:36:07 -06:00
hc-github-team-secure-vault-core
a420deb5e4 Backport of Limit number of tests in CI comment into release/1.13.x (#21970)
* backport of commit dc104898f7 (#21853)

* fix multiline

* shellcheck, and success message for builds

* add full path

* cat the summary

* fix and faster

* fix if condition

* base64 in a separate step

* echo

* check against empty string

* add echo

* only use matrix ids

* only id

* echo matrix

* remove wrapping array

* tojson

* try echo again

* use jq to get packages

* don't quote

* only run binary tests once

* only run binary tests once

* test what's wrong with the binary

* separate file

* use matrix file

* failed test

* update comment on success

* correct variable name

* bae64 fix

* output to file

* use multiline

* fix

* fix formatting

* fix newline

* fix whitespace

* correct body, remove comma

* small fixes

* shellcheck

* another shellcheck fix

* fix deprecation checker

* only run comments for prs

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* fixes

---------

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* backport of commit 3b00dde1ba (#21936)

* limit test comments

* remove unecessary tee

* fix go test condition

* fix

* fail test

* remove ailways entirely

* fix columns

* make a bunch of tests fail

* separate line

* include Failures:

* remove test fails

* fix whitespace

* backport of commit 245430215c (#21973)

* only add binary tests if they exist

* shellcheck

---------

Co-authored-by: miagilepner <mia.epner@hashicorp.com>
Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
2023-07-20 15:07:01 +02:00
Kuba Wieczorek
d1e54e6c7e Fix UI tests on 1.13.x in CI workflow (#21860)
* Back out an accidental backport of a node version change to UI tests in CI

* Specify the Node version directly in the workflow
2023-07-14 15:38:08 +00:00
hc-github-team-secure-vault-core
c0007f936e VAULT-12958 Add link to logs to the test failure summary in CI (#21736) (#21824)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-07-13 18:55:16 +00:00
hc-github-team-secure-vault-core
9eebd596a8 backport of commit bfa93fdeda (#21782) (#21785)
* use shas instead of versions and fix milestones

* remove trailing space

Co-authored-by: miagilepner <mia.epner@hashicorp.com>
2023-07-13 15:19:16 +02:00
hc-github-team-secure-vault-core
5bd8506c3a [QT-589] Use the go module cache between CI and build (#21764) (#21789)
In order to reliably store Go test times in the Github Actions cache we
need to reduce our cache thrashing by not using more than 10gb over all
of our caches. This change reduces our cache usage significantly by
sharing Go module cache between our Go CI workflows and our build
workflows. We lose our per-builder cache which will result in a bit of
performance hit, but we'll enable better automatic rebalancing of our CI
workflows. Overall we should see a per branch reduction in cache sizes
from ~17gb to ~850mb.

Some preliminary investigation into this new strategy:

Prior build workflow strategy on a cache miss:
  Download modules: ~20s
  Build Vault: ~40s
  Upload cache: ~30s
  Total: ~1m30s

Prior build workflow strategy on a cache hit:
  Download and decompress modules and build cache: ~12s
  Build Vault: ~15s
  Total: ~28s

New build workflow strategy on a cache miss:
  Download modules: ~20
  Build Vault: ~40s
  Upload cache: ~6s
  Total: ~1m6s

New build workflow strategy on a cache hit:
  Download and decompress modules: ~3s
  Build Vault: ~40s
  Total: ~43s

Expected time if we used no Go caching:
  Download modules: ~20
  Build Vault: ~40s
  Total: ~1m

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-07-12 19:20:41 +00:00
Ryan Cragun
b465b7e111 ci: use the correct version of node for test-ui (#21733)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-07-10 12:52:59 -06:00
hc-github-team-secure-vault-core
a63e7cb4b8 backport of commit ece2995ee1 (#21730)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-07-10 18:06:48 +00:00
hc-github-team-secure-vault-core
5ee5e2ce46 backport of 8c18f24b9d (#21611) (#21614)
* combine into one checker

* combine and simplify ci checks

* add to test package list

* remove testing test

* only run deprecations check

* only run deprecations check

* remove unneeded repo check

* fix bash options

Co-authored-by: miagilepner <mia.epner@hashicorp.com>
2023-07-10 15:25:45 +02:00
hc-github-team-secure-vault-core
e3646c2ff7 backport of commit 5919645a70 (#21706)
Co-authored-by: miagilepner <mia.epner@hashicorp.com>
2023-07-10 10:59:13 +00:00
hc-github-team-secure-vault-core
d9489b8daf VAULT-17592 Extract failed Go test results across runners (#21625) (#21671)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-07-07 19:30:51 +00:00
hc-github-team-secure-vault-core
ac380ce1d3 [QT-576] Optimize build workflow (#21486) (#21594)
Improve our build workflow execution time by using custom runners,
improved caching and conditional Web UI builds.

Runners
-------
We improve our build times[0] by using larger custom runners[1] when
building the UI and Vault.

Caching
-------
We improve Vault caching by keeping a cache for each build job. This
strategy has the following properties which should result in faster
build times when `go.sum` hasn't been changed from prior builds, or
when a pull request is retried or updated after a prior successful
build:

* Builds will restore cached Go modules and Go build cache according to
  the Go version, platform, architecture, go tags, and hash of `go.sum`
  that relates to each individual build workflow. This reduces the
  amount of time it will take to download the cache on hits and upload
  the cache on misses.
* Parallel build workflows won't clobber each others build cache. This
  results in much faster compile times after cache hits because the Go
  compiler can reuse the platform, architecture, and tag specific build
  cache that it created on prior runs.
* Older modules and build cache will not be uploaded when creating a new
  cache. This should result in lean cache sizes on an ongoing basis.
* On cache misses we will have to upload our compressed module and build
  cache. This will slightly extend the build time for pull requests that
  modify `go.sum`.

Web UI
------
We no longer build the web UI in every build workflow. Instead we separate
the UI building into its own workflow and cache the resulting assets.
The same UI assets are restored from cache during build worklows. This
strategy has the following properties:

* If the `ui` directory has not changed from prior builds we'll restore
  `http/web_ui` from cache and skip building the UI for no reason.
* We continue to use the built-in `yarn` caching functionality in
  `action/setup-node`. The default mode saves the `yarn` global cache.
  to improve UI build times if the cache has not been modified.

Changes
-------
* Add per platform/archicture Go module and build caching
* Move UI building into a separate job and cache the result
* Restore UI cache during build
* Pin workflows

Notes
-----
[0] https://hashicorp.atlassian.net/browse/QT-578
[1] https://github.com/hashicorp/vault/actions/runs/5415830307/jobs/9844829929

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-07-05 14:53:38 -06:00
hc-github-team-secure-vault-core
73f835d814 backport of commit eecae3a827 (#21550) (#21555)
Co-authored-by: miagilepner <mia.epner@hashicorp.com>
2023-07-04 17:07:01 +02:00
hc-github-team-secure-vault-core
40a6cf887d backport of commit 567917efac (#21204)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-06-13 20:28:19 +00:00
hc-github-team-secure-vault-core
14d6fb5f24 backport of commit 735e2866db (#20761)
Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com>
2023-05-24 21:53:28 +00:00
hc-github-team-secure-vault-core
cf2f0819e9 backport of commit 8a86f592d3 (#20489)
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2023-05-03 18:00:36 +00:00
hc-github-team-secure-vault-core
0966c2bcba backport of commit e78d9a3052 (#20153)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-04-13 20:04:52 +00:00
hc-github-team-secure-vault-core
1c92321937 backport of commit 4b843dc7a5 (#20093)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-04-11 22:14:11 +00:00
Marc Boudreau
8a64b17ce0 add workflow_dispatch trigger to ci.yml workflow (#19979) (#19994) 2023-04-06 16:43:07 +01:00
hc-github-team-secure-vault-core
a7feba66c7 backport of commit de381c30f6 (#19968)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-04-03 19:48:29 +00:00
hc-github-team-secure-vault-core
e3f471c0a2 Backport of Update the if conditions for test-go jobs in CI into release/1.13.x (#19872)
* Update the if conditions for test-go jobs in CI

* Fix errors in comments

* Update the if condition for the UI tests

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-04-03 10:48:05 -04:00
hc-github-team-secure-vault-core
d769d200bd backport of commit fc631700c6 (#19904)
Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>
2023-03-31 12:59:52 -04:00
hc-github-team-secure-vault-core
db9434877d backport of commit 525bce060d (#19869)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-30 20:20:20 +00:00
hc-github-team-secure-vault-core
2ec4fbf688 backport of commit 9b379ae283 (#19865)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-30 14:55:01 -04:00
hc-github-team-secure-vault-core
8530990f95 Backport of Add a new category of runners to the CI workflow; use new, dedicated … into release/1.13.x (#19855)
* backport of commit daf4ec2b4f

* Add compute-huge output to setup step in CI

* Remove redundant fromJSON call

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-30 18:43:50 +01:00
Marc Boudreau
b500045c29 Backport all GHA Migration Changes to release/1.13.x Branch (#19767)
* backport all gha migration changes to release/1.13.x

* remove the .circleci directory

* remove references to circleci configuration from pre-commit hook

* remove reference to .circleci in Makefile

* port change to how gofumpt is executed in Makefile

* add gotestsum to tools/tools.go

* remove postgresql/scram package from generate-test-package-lists.sh since it didn't exist in release 1.13 or earlier

* blank out environment variables to allow test to properly function

* use go:embed to load files into test

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-30 11:00:02 -04:00