Commit Graph

43 Commits

Author SHA1 Message Date
Kuba Wieczorek
74d15e3d50 [VAULT-28666] Remove the errexit option from the retry script and add increasing wait on failure (up to 5 seconds and 5 retries) (#27842)
Co-authored-by: VAL <val@hashicorp.com>
2024-07-23 17:58:37 +00:00
Josh Black
56b32081f0 add a retry-command script (#27754)
* add a retry-command script

* add license header to retry script
2024-07-12 13:18:41 -07:00
Ryan Cragun
15eb4e4060 ci: fix notifications and comments (#25356)
* Fix the build notification. It appears that during a rebase the JSON
  payload was slightly corrupted.
* Don't create a successful CI step summary if the CI workflow is
  cancelled.
* Don't create a successful CI comment if the workflow was cancelled.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-02-12 09:52:13 -07:00
Hamid Ghaf
a041111206 remove regular expression comparison in a GHA script (#25347) 2024-02-09 13:57:46 -08:00
Ryan Cragun
3f2f8ab64d ci: fix changed file detection (#25262)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-02-07 18:02:02 +00:00
Ryan Cragun
89c75d3d7c [QT-637] Streamline our build pipeline (#24892)
Context
-------
Building and testing Vault artifacts on pull requests and merges is
responsible for about 1/3rd of our overall spend on Vault CI. Of the
artifacts that we ship as part of a release, we do Enos testing scenarios
on the `linux/amd64` and `linux/arm64` binaries and their derivative
artifacts. The extended build artifacts for non-Linux platforms or less
common machine architectures are not tested at this time. They are built,
notarized, and signed as part of every pull request update and merge. As
we don't actually test these artifacts, the only gain we get from this
rather expensive behavior is that we wont merge a change that would prevent
Vault from building on one of the extended targets. Extended platform or
architecture changes are quite rare, so performing this work as frequently
as we do is costly in both monetary and developer time for little relative
safety benefit.

Goals
-----
Rethink and implement how and when we build binaries and artifacts of Vault
so that we can spend less money on repetitive work and while also reducing
the time it takes for the build and test pipelines to complete.

Solution
--------
Instead of building all release artifacts on every push, we'll opt to build
only our testable (core) artifacts. With this change we are introducing a
bit of risk. We could merge a change that breaks an extended platform and
only find out after the fact when we trigger a complete build for a release.
We'll hedge against that risk by building all of the release targets on a
scheduled cadence to ensure that they are still buildable.

We'll make building all of the targets optional on any pull request by
use of a `build/all` label on the pull request.

Further considerations
----------------------
* We want to reduce the total number of workflows and runners for all of our
  pipelines if possible. As each workflow runner has infrastructure cost and
  runner time penalties, using a single runner over many is often preferred.
* Many of our jobs runners have been optimized for cost and performance. We
  should simplify the choices of which runners to use.
* CRT requires us to use the same build workflow in both CE and Ent.
  Historically that meant that modifying `build.yml` in CE would result in a
  merge conflict with `build.yml` in Ent, and break our merge workflows.
* Workflow flow control in both `build.yml` and `ci.yml` can be quite
  complicated, as each needs to maintain compatibility whether executed as CE
  or Ent, and when triggered with various Github events like pull_request,
  push, and workflow_call, each with their own requirements.
* Many jobs utilize similar patterns of flow control and metadata but are not
  reusable.
* Workflow call depth has a maximum of four, so we need to be quite
  considerate when calling other workflows.
* Called workflows can only have 10 inputs.

Implementation
--------------
* Refactor the `build.yml` workflow to be agnostic to whether or not it is
  executing in CE or Ent. That makes future updates to the build much easier
  as we won't have to worry about merge conflicts when the change is merged
  downstream.
* Extract common steps in workflows into composite actions that we can reuse.
* Fix bugs where some but not all workflows would use different Git
  references when building and testing a pull request.
* We rewrite the application, docs, and UI change helpers as a composite
  action. This allows us to re-use this logic to make consistent behavior
  choices across build and CI.
* We combine several `build.yml` and `ci.yml` jobs into our final job.
  This reduces the number of workflows required for the same behavior while
  saving time overall.
* Update most of our action pins.

Results
-------

| Metric            | Before   | After   | Diff  |
|-------------------|----------|---------|-------|
| Duration:         | ~14-18m  | ~15-18m | ~ =   |
| Workflows:        | 43       | 18      | - 58% |
| Billable time:    | ~1h15m   | 16m     | - 79% |
| Saved artifacts:  | 34       | 12      | - 65% |

Infra costs should map closely to billable time.
Network I/O costs should map closely to the workflow count.
Storage costs should map directly with saved artifacts.

We could probably get parity with duration by getting more clever with
our UBI container build, as that's where we're seeing the increase. I'm
not yet concerned as it takes roughly the same time for this job to
complete as it did before.

While the CI workflow was not the focus on the PR, some shared
refactoring does show some marginal improvements there.

| Metric            | Before   | After    | Diff   |
|-------------------|----------|----------|--------|
| Duration:         | ~24m     | ~12.75m  | - 15%  |
| Workflows:        | 55       | 47       | - 8%   |
| Billable time:    | ~4h20m   | ~3h36m   | - 7%   |

Further focus on streamlining the CI workflows would likely result in a
few more marginal improvements, but nothing on the order like we've seen
with the build workflow.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-02-06 21:11:33 +00:00
Hamid Ghaf
163c03f514 exclude changelog in verifying doc/ui PRs (#23601) 2023-10-11 08:18:23 -07:00
hashicorp-copywrite[bot]
0b12cdcfd1 [COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Nick Cabatoff
7398afcc9a Instead of looking for a comment that contains our signature string, require that it startswith that string. (#22047) 2023-07-25 09:57:07 -04:00
miagilepner
3b00dde1ba Limit number of tests in CI comment (#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
2023-07-20 11:21:49 +02:00
miagilepner
dc104898f7 VAULT-17660: create CI github comment (#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>
2023-07-18 17:31:29 +02:00
Hamid Ghaf
f3e9d159d3 report build failures in a PR comment (#21722)
* report build failures in a PR comment

* address action linter

* linter

* add an id

* change permission

* report failure from build yaml

* linter fix

* report workflow url

* reorder jobs

* complete boolean eval

* single quote

* experiment getting failed jobs

* linter

* pass failed jobs one by one

* failed jobs are reported cancelled

* use * instead of @

* some polishing

* find comment ID, create or update it

* some clean up

* missing }
2023-07-17 07:45:32 -07:00
John-Michael Faircloth
c121728a69 plugin automation: use gh cli and add labels (#21657)
* plugin automation: use gh cli and add labels

* remove unneeded fields

* reorder steps

* remove comment

* fix typo

* add some validation
2023-07-12 16:28:56 -04:00
Mike Palmiotto
702c521489 Auto-balancing test runners (#21745)
Integrate the `test-go` workflow with `gotestsum tool ci-matrix`. The
tool uses the output of `go list ./...` along with timing files emitted
by `gotestsum` to generate a test matrix of 16 runners with evenly
distributed runtimes.

We intentionally ignore binary, docker-based test files for the initial
matrix creation and then inject a 17th runner, dedicated to building
Vault and running the entire binary test suite together. This avoids
duplication of build overhead when binary tests are rebalanced across
multiple runners in the generated matrix.

In order to maintain test results from previous runs, we cache the test
results after every run of `gotestsum`. Each cache entry occupies ~36MB
after compression on enterprise, at the time of this commit.

We'll have to keep an eye on this to make sure timing data is not
evicted from the cache, but in theory it should be toward the top of the
LRU entries.
2023-07-12 11:19:50 -04:00
Hamid Ghaf
3443ff1cc1 use verify changes for docs to skip tests (#21620)
* use verify changes for docs to skip tests

* add verify-changes to the needed jobs

* skip go tests for doc/ui only changes

* fix a job ref

* change names, remove script

* remove ui conditions

* separate flags

* feedback
2023-07-11 09:06:48 -07:00
John-Michael Faircloth
506db7b9bf workflows: update plugin check job to use branch as ref (#21638)
* workflows: update plugin check job to use branch as ref

* make actionlint happy
2023-07-06 21:18:52 +00:00
kpcraig
9930849f82 Plugin workflow updates (#21581)
Update/Polish plugin-dispatched vault-side plugin workflow
2023-07-06 10:50:09 -04:00
miagilepner
8c18f24b9d VAULT-17734, VAULT-17735: Combine linters (#21611)
* 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
2023-07-06 15:18:42 +02:00
Peter Wilson
5c02e3f255 VAULT-17772: audit event base (#21577)
* observability/event package, and basic error
* sink types (and validation test)
* event types (and validation test)
* options for events (and tests)
* audit event type (and tests)
2023-07-06 10:06:27 +00:00
kpcraig
bbb01ed554 update plugin-dependency-check workflow (#21525) 2023-06-30 16:57:49 +00:00
kpcraig
3feb157fc7 fix curl, add reviewers, fix label call (#21522) 2023-06-30 15:49:28 +00:00
John-Michael Faircloth
00295d2bf5 plugin automation: fix create pr (#21518)
* plugin automation: fix create pr

* get vault pr num
2023-06-29 22:20:01 +00:00
kpcraig
208336d251 Add some debugging to figure out what is happening (#21516)
* println debugging

* add more print debugs
2023-06-29 21:07:28 +00:00
John-Michael Faircloth
ab97243ed0 plugin automation: fix branch name (#21515)
* plugin automation: fix branch name

* fix input name
2023-06-29 19:45:53 +00:00
John-Michael Faircloth
cc5240f47d updates to plugin update check (#21511)
* updates to plugin update check

* use script to make curl request easier
2023-06-29 16:23:52 +00:00
Christopher Swenson
cf48236a3c Move database connections map out to separate package (#21207)
The upcoming event main plugin will use a very similar pattern
as the database plugin map, so it makes sense to refactor this and move
this map out. It also cleans up the database plugin backend so that
it does not have to keep track of the lock.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-06-22 10:20:13 -07:00
miagilepner
30aac443d0 Fix verify test packages GOPRIVATE (#21318) 2023-06-16 16:54:58 +00:00
Nick Cabatoff
d3ae2085ae Rework the test package tester to avoid grep pitfalls. (#21281) 2023-06-15 19:08:37 +00:00
Violet Hynes
f0c9519023 VAULT-15835 Add GHA that checks for nil, nil returns on functions that return an error (#21099)
* VAULT-15385 Add GHA that checks for nil, nil returns on functions that return an error

* VAULT-15385 add failing function, for sanity

* VAULT-15385 fix makefile

* VAULT-15385 remove test dir

* VAULT-15385 Fix typo

* VAULT-15385 fix job name

* VAULT-15385 Add test to packages

* VAULT-15835 add opt-out

* VAULT-15835 Wrong file for comment

* VAULT-15835 remove failing function

* VAULT-15835 return not nil-nil :)

* VAULT-15835 Restrict to two-result functions
2023-06-13 12:32:06 -04:00
Anton Averchenkov
21eccf8b8d agent: Add agent process supervisor tests (#20741) 2023-05-30 18:06:44 +00:00
Alexander Scheel
b8082f5234 sdk/helper/nonce -> go-secure-stdlib/nonceutil (#20737)
Depends on https://github.com/hashicorp/go-secure-stdlib/pull/73

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-25 20:57:08 +00:00
Alexander Scheel
b1f0d4e495 Add nonce service to sdk/helpers, use in PKI (#20688)
* Build a better nonce service

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add internal nonce service for testing

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add benchmarks for nonce service

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add statistics around how long tidy took

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Replace ACME nonces with shared nonce service

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add an initialize method to nonce services

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Use the new initialize helper on nonce service in PKI

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add additional tests for nonces

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Format sdk/helper/nonce

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Use default 90s nonce expiry in PKI

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Remove parallel test case as covered by benchmark

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add additional commentary to encrypted nonce implementation

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add nonce to test_packages

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-23 19:44:05 +00:00
Violet Hynes
3d7d8f4965 VAULT-15547 Agent/proxy decoupling, take two (#20634)
* VAULT-15547 Additional tests, refactoring, for proxy split

* VAULT-15547 Additional tests, refactoring, for proxy split

* VAULT-15547 Import reorganization

* VAULT-15547 Some missed updates for PersistConfig

* VAULT-15547 address comments

* VAULT-15547 address comments
2023-05-19 13:17:48 -04:00
Violet Hynes
6b4b0f7aaf VAULT-15547 First pass at agent/proxy decoupling (#20548)
* VAULT-15547 First pass at agent/proxy decoupling

* VAULT-15547 Fix some imports

* VAULT-15547 cases instead of string.Title

* VAULT-15547 changelog

* VAULT-15547 Fix some imports

* VAULT-15547 some more dependency updates

* VAULT-15547 More dependency paths

* VAULT-15547 godocs for tests

* VAULT-15547 godocs for tests

* VAULT-15547 test package updates

* VAULT-15547 test packages

* VAULT-15547 add proxy to test packages

* VAULT-15547 gitignore

* VAULT-15547 address comments

* VAULT-15547 Some typos and small fixes
2023-05-17 09:38:34 -04:00
Jaymala
a9aa744ae4 Update verify-changes to support external docs branches (#20535)
* Update verify-changes to support external docs branches

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

* Revert QT-545 as it Enos workflow is not a workflow_run event

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

---------

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-05-08 15:03:23 -04:00
Nick Cabatoff
7012ce2637 Use a dedicated runner for the binary-based tests. (#20377) 2023-04-27 09:41:49 -04:00
Jaymala
788f337bbf Fix script to verify docs changes (#20317)
Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-04-24 13:16:01 -04:00
Jaymala
166f270613 [QT-517] Skip builds for docs PRs (#20036)
* [QT-517] Skip builds for docs changes

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

* [QT-545] Enable Enos tests to also run on forked PRs

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

* Add comments and fix CI errors

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

---------

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-04-21 10:58:47 -04:00
Alexander Scheel
c83a5629a6 Remove acme from CI test_packages (#19841)
Of course, forgetting to add it, I forgot to remove it...

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-03-30 07:20:58 -04:00
Alexander Scheel
c3fce3512c Tighten JWS algorithm lists (#19797)
* Add new PKI ACME subpackage to test_packages list

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Restrict JWS keys to specified algorithms

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-03-28 20:49:07 +00:00
Raymond Ho
ba963a8c65 VAULT-13614 Support SCRAM-SHA-256 encrypted passwords for PostgreSQL (#19616) 2023-03-21 12:12:53 -07:00
Hamid Ghaf
e55c18ed12 adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00
Marc Boudreau
d6c71614a8 Introduce GitHub Actions CI Workflow (#19449)
* Migrate subset of CircleCI ci workflow to GitHub Actions

Runs test-go and test-go-remote-docker with a static splitting of test packages

* [skip actions] add comment to explain the purpose of test-generate-test-package-lists.sh and what to do if it fails

* change trigger to push

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-06 16:57:55 -05:00