25 Commits

Author SHA1 Message Date
Vault Automation
0c6c13dd38
license: update headers to IBM Corp. (#10229) (#10233)
* license: update headers to IBM Corp.
* `make proto`
* update offset because source file changed

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2025-10-21 15:20:20 -06:00
Vault Automation
853cbe1ac9
[VAULT-39671] tools: use github cache for all tools (#9622) (#9634)
* [VAULT-39671] tools: use github cache for external tools

We currently have some ~13 tools that we need available both locally for
development and in CI for building, linting, and formatting, and testing Vault.
Each branch that we maintain often uses the same set of tools but often pinned
to different versions.

For development, we have a `make tools` target that will execute the
`tools/tool.sh` installation script for the various tools at the correct pin.
This works well enough but is cumbersome if you’re working across many branches
that have divergent versions.

For CI the problem is speed and repetition. For each build job (~10) and Go test
job (16-52) we have to install most of the same tools for each job. As we have
extremely limited Github Actions cache we can’t afford to cache the entire vault
go build cache, so if we were to build them from source each time we incur a
penalty of downloading all of the modules and building each tool from source.
This yields about an extra 2 minutes per job to install all of the tools. We’ve
worked around this problem by writing composite actions that download pre-built
binaries of the same tools instead of building them from source. That usually
takes a few seconds. The downside of that approach is rate limiting, which
Github has become much more aggressive in enforcing.

That leads us to where we are before this work:
  - For builds in the compatibility docker container: the tools are built from
    source and cached as separate builder image layer. (usually fast as we get
    cache hits, slow on cache misses)
  - For builds that compile directly on the runner: the tools are installed on
    each job runner by composite github actions (fast, uses API requests, prone
    to throttling)
  - For tests, they use the same composite actions to install the tools on each
    job. (fast, uses API requests, prone to throttling)

This also leads to inconsistencies since there are two sources of truth: the
composite actions have their own version pin outside of those in `tools.sh`.
This has led to drift.

We previously tried to save some API requests and move all builds into
the container. That almost works but docker's build conatiner had a hard
time with some esoteric builds. We could special case it but it's a bandaid at
best.

A prior version of this work (VAULT-39654) investigated using `go tool`, but
there were some showstopper issues with that workflow that make it a non-starter
for us. Instead, we’ll attempt to use more actions cache to resolve the
throttling. This will allow us to have a single source of truth for tools, their
pins, and afford us the same speed on cache hits as we had previously without
downloading the tools from github releases thousands of times per day.

We add a new composite github action for installing our tools.
  - On cache misses it builds the tools and installs them into a cacheable path.
  - On cache hits it restore the cacheable path.
  - It adds the tools to the GITHUB_PATH to ensure runner based jobs can find
    them.
  - For Docker builds it mounts the tools at `/opt/tools/bin` which is
    part of the PATH in the container.
  - It uses a cache key of the SHA of the tools directory along with the
    working directory SHA which is required to deal with actions/cache
    issues.

This results in:
  - A single source of truth for tools and their pins
  - A single cache for tools that can be re-used between all CI and build jobs
  - No more Github API calls for tooling. *_Rate limiting will be a thing of
    the past._*

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2025-09-25 14:26:02 -07:00
Vault Automation
a73eca5759
Backport license: add support for publishing artifacts to IBM PAO into ce/main (#9208)
* license: add support for publishing artifacts to IBM PAO (#8366)

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: brian shore <bshore@hashicorp.com>
Co-authored-by: Ethel Evans <ethel.evans@hashicorp.com>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2025-09-11 11:25:15 -06:00
Ryan Cragun
befafd5a9c
[VAULT-35682] build(cgo): Build CGO binaries in a container (#30834)
Ubuntu 20.04 has reached EOL and is no longer a supported runner host distro. Historically we've relied on it for our CGO builds as it contains an old enough version of glibc that we can retain compatibility with all of our supported distros and build on a single host distro. Rather than requiring a new RHEL 8 builder (or some equivalent), we instead build CGO binaries inside an Ubuntu 20.04 container along with its glibc and various C compilers.

I've separated out system package changes, the Go toolchain install, and external build tools tools install into different container layers so that the builder container used for each branch is maximally cacheable.

On cache misses these changes result in noticeably longer build times for CGO binaries. That is unavoidable with this strategy. Most of the time our builds will get a cache hit on all layers unless they've changed any of the following:
- .build/*
- .go-version
- .github/actions/build-vault
- tools/tools.sh
- Dockerfile

I've tried my best to reduce the cache space used by each layer. Currently our build container takes about 220MB of cache space. About half of that ought to be shared cache between main and release branches. I would expect total new cache used to be in the 500-600MB range, or about 5% of our total space.

Some follow-up idea that we might want to consider:
- Build everything inside the build container and remove the github actions that set up external tools
- Instead of building external tools with `go install`, migrate them into build scripts that install pre-built `linux/amd64` binaries
- Migrate external to `go tool` and use it in the builder container. This requires us to be on 1.24 everywhere so ought not be considered until that is a reality.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-06-03 17:32:14 -06:00
Ryan Cragun
c8e6169d5d
VAULT-31402: Add verification for all container images (#28605)
* VAULT-31402: Add verification for all container images

Add verification for all container images that are generated as part of
the build. Before this change we only ever tested a limited subset of
"default" containers based on Alpine Linux that we publish via the
Docker hub and AWS ECR.

Now we support testing all Alpine and UBI based container images. We
also verify the repository and tag information embedded in each by
deploying them and verifying the repo and tag metadata match our
expectations.

This does change the k8s scenario interface quite a bit. We now take in
an archive image and set image/repo/tag information based on the
scenario variants.

To enable this I also needed to add `tar` to the UBI base image. It was
already available in the Alpine image and is used to copy utilities to
the image when deploying and configuring the cluster via Enos.

Since some images contain multiple tags we also add samples for each
image and randomly select which variant to test on a given PR.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-10-07 10:16:22 -06:00
Ryan Cragun
78e1cceccc
ubi: fix HasLicense Redhat requirement (#28216)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-08-29 09:14:09 -06:00
Bianca Moreira
64a30805d6
Fix license for ubi dockerfile (#28141) 2024-08-21 17:33:48 +00:00
Bianca Moreira
b20e3120c8
Fix Dockerfile LICENSE.txt path (#28087) 2024-08-15 14:19:55 +02:00
Ryan Cragun
40698e962b
docker: use alpine 3 and UBI 8 tags instead of minor version pins (#27971)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-08-05 12:09:19 -06:00
Ryan Cragun
158ad050a7
docker: update ubi-minimal image to 8.10 (#27309)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-05-31 18:06:20 +00:00
Bianca Moreira
27f39ffbe9
Add license file to Dockerfile as per legal requirement (#27154) 2024-05-22 10:58:08 +02:00
Mark Collao
0b5bd2dd3b
PSA-714 - update ubi-minimal to 8.9 for security fixes (#25417) 2024-02-15 19:10:55 +00:00
mickael-hc
758de878d6
Update Docker base image to Alpine 3.18 (#23217)
Alpine 3.15 will be end-of-life on Nov 1 2023
2023-09-21 12:36:58 -04:00
Nicholas Anthony Suhartono
9bb921f5f2
fix typo by changing shoud to should (#19915) 2023-08-17 23:47:32 +00: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
Theron Voran
a98e239cc6
dockerfile: ubi-minimal:8.7 -> 8.8 (#20640) 2023-05-18 10:02:18 -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
Theron Voran
870f7ecb21
dockerfile: ubi-minimal:8.6 => 8.7 (#17952) 2022-11-16 10:14:54 -08:00
Theron Voran
d31ae8965d
dockerfile: use ubi-minimal:8.6 (#16095) 2022-06-21 13:55:12 -07:00
Alexander Scheel
41ef3644f0
Fix ubi-docker-entrypoint.sh->docker-entrypoint.sh (#15443)
It is believed to break the helm chart; see also:

https://github.com/hashicorp/vault/pull/15272#discussion_r873927744

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-05-16 13:12:38 -04:00
Alexander Scheel
48967c866f
Set HOME=/home/vault in UBI Dockerfile (#15439)
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-05-16 12:43:57 -04:00
Alexander Scheel
dc98295e4c
UBI Containerfile - CRT Enablement (#15272)
* Copy UBI Dockerfile into Vault

This Dockerfile was modeled off of the existing Alpine Dockerfile (in
this repo) and the external Dockerfile from the docker-vault repo:

> https://github.com/hashicorp/docker-vault/blob/master/ubi/Dockerfile

We also import the UBI-specific docker-entrypoint.sh, as certain
RHEL/Alpine changes (like interpreter) require a separate entry script.

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

* Add UBI build to CRT pipeline

Also adds workflow_dispatch to the CRT pipeline, to allow manually
triggering CRT from PRs, when desired.

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

* Update Dockerfile

Co-authored-by: Sam Salisbury <samsalisbury@gmail.com>

* Update Dockerfile

Co-authored-by: Sam Salisbury <samsalisbury@gmail.com>

* Update Dockerfile

Co-authored-by: Sam Salisbury <samsalisbury@gmail.com>

* Update Dockerfile

* Update Dockerfile

* Update build.yml

Allow for both push to arbitrary branch plus workflow dispatch, per Newsletter article.

Co-authored-by: Sam Salisbury <samsalisbury@gmail.com>
2022-05-13 11:21:15 -04:00
Alvin Huang
0ee2ac3322
rename Dockerfile build-arg VERSION to PRODUCT_VERSION (#14369) 2022-03-10 12:59:30 +00:00
claire labry
935b12a1f9
add security-scan for CRT (#13627)
* add security-scan

* updating the alpine version

* clean up

* update the alpine version to be more prescriptive
2022-01-31 11:35:25 -05:00
claire labry
1bec99602c
adding CRT to main branch (#13088)
* adding CRT to main branch

* cleanup

* um i dont know how that got removed but heres the fix

* add vault.service

Co-authored-by: Kyle Penfound <kpenfound11@gmail.com>
2021-12-06 11:06:22 -05:00