bd5d738ad7
Introducing a new approach to testing Vault artifacts before merge and after merge/notorization/signing. Rather than run a few static scenarios across the artifacts, we now have the ability to run a pseudo random sample of scenarios across many different build artifacts. We've added 20 possible scenarios for the AMD64 and ARM64 binary bundles, which we've broken into five test groups. On any given push to a pull request branch, we will now choose a random test group and execute its corresponding scenarios against the resulting build artifacts. This gives us greater test coverage but lets us split the verification across many different pull requests. The post-merge release testing pipeline behaves in a similar fashion, however, the artifacts that we use for testing have been notarized and signed prior to testing. We've also reduce the number of groups so that we run more scenarios after merge to a release branch. We intend to take what we've learned building this in Github Actions and roll it into an easier to use feature that is native to Enos. Until then, we'll have to manually add scenarios to each matrix file and manually number the test group. It's important to note that Github requires every matrix to include at least one vector, so every artifact that is being tested must include a single scenario in order for all workflows to pass and thus satisfy branch merge requirements. * Add support for different artifact types to enos-run * Add support for different runner type to enos-run * Add arm64 scenarios to build matrix * Expand build matrices to include different variants * Update Consul versions in Enos scenarios and matrices * Refactor enos-run environment * Add minimum version filtering support to enos-run. This allows us to automatically exclude scenarios that require a more recent version of Vault * Add maximum version filtering support to enos-run. This allows us to automatically exclude scenarios that require an older version of Vault * Fix Node 12 deprecation warnings * Rename enos-verify-stable to enos-release-testing-oss * Convert artifactory matrix into enos-release-testing-oss matrices * Add all Vault editions to Enos scenario matrices * Fix verify version with complex Vault edition metadata * Rename the crt-builder to ci-helper * Add more version helpers to ci-helper and Makefile * Update CODEOWNERS for quality team * Add support for filtering matrices by group and version constraints * Add support for pseudo random test scenario execution Signed-off-by: Ryan Cragun <me@ryan.ec>
225 lines
8.1 KiB
YAML
225 lines
8.1 KiB
YAML
---
|
|
name: build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/**
|
|
|
|
env:
|
|
PKG_NAME: vault
|
|
|
|
jobs:
|
|
product-metadata:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
build-date: ${{ steps.get-metadata.outputs.build-date }}
|
|
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
go-version: ${{ steps.get-metadata.outputs.go-version }}
|
|
matrix-test-group: ${{ steps.get-metadata.outputs.matrix-test-group }}
|
|
package-name: ${{ steps.get-metadata.outputs.package-name }}
|
|
vault-revision: ${{ steps.get-metadata.outputs.vault-revision }}
|
|
vault-version: ${{ steps.get-metadata.outputs.vault-version }}
|
|
vault-base-version: ${{ steps.get-metadata.outputs.vault-base-version }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Get metadata
|
|
id: get-metadata
|
|
env:
|
|
# MATRIX_MAX_TEST_GROUPS is required to determine the randomly selected
|
|
# test group. It should be set to the highest test_group used in the
|
|
# enos-run-matrices.
|
|
MATRIX_MAX_TEST_GROUPS: 5
|
|
run: |
|
|
echo "build-date=$(make ci-get-date)" >> $GITHUB_OUTPUT
|
|
echo "go-version=$(cat ./.go-version)" >> $GITHUB_OUTPUT
|
|
echo "matrix-test-group=$(make ci-get-matrix-group-id)" >> $GITHUB_OUTPUT
|
|
echo "package-name=${{ env.PKG_NAME }}" >> $GITHUB_OUTPUT
|
|
echo "vault-base-version=$(make ci-get-version-base)" >> $GITHUB_OUTPUT
|
|
echo "vault-revision=$(make ci-get-revision)" >> $GITHUB_OUTPUT
|
|
echo "vault-version=$(make ci-get-version)" >> $GITHUB_OUTPUT
|
|
- uses: hashicorp/actions-generate-metadata@v1
|
|
id: generate-metadata-file
|
|
with:
|
|
version: ${{ steps.get-metadata.outputs.vault-version }}
|
|
product: ${{ steps.get-metadata.outputs.package-name }}
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: metadata.json
|
|
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
if-no-files-found: error
|
|
|
|
build-other:
|
|
name: Build Vault Other
|
|
needs: product-metadata
|
|
strategy:
|
|
matrix:
|
|
goos: [freebsd, windows, netbsd, openbsd, solaris]
|
|
goarch: [386, amd64, arm]
|
|
exclude:
|
|
- goos: solaris
|
|
goarch: 386
|
|
- goos: solaris
|
|
goarch: arm
|
|
- goos: windows
|
|
goarch: arm
|
|
fail-fast: true
|
|
uses: ./.github/workflows/build-vault-oss.yml
|
|
with:
|
|
create-packages: false
|
|
goarch: ${{ matrix.goarch }}
|
|
goos: ${{ matrix.goos }}
|
|
go-tags: ui
|
|
go-version: ${{ needs.product-metadata.outputs.go-version }}
|
|
package-name: ${{ needs.product-metadata.outputs.package-name }}
|
|
vault-version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
secrets: inherit
|
|
|
|
build-linux:
|
|
name: Build Vault Linux
|
|
needs: product-metadata
|
|
strategy:
|
|
matrix:
|
|
goos: [linux]
|
|
goarch: [arm, arm64, 386, amd64]
|
|
fail-fast: true
|
|
uses: ./.github/workflows/build-vault-oss.yml
|
|
with:
|
|
goarch: ${{ matrix.goarch }}
|
|
goos: ${{ matrix.goos }}
|
|
go-tags: ui
|
|
go-version: ${{ needs.product-metadata.outputs.go-version }}
|
|
package-name: ${{ needs.product-metadata.outputs.package-name }}
|
|
vault-version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
secrets: inherit
|
|
|
|
build-darwin:
|
|
name: Build Vault Darwin
|
|
needs: product-metadata
|
|
strategy:
|
|
matrix:
|
|
goos: [darwin]
|
|
goarch: [amd64, arm64]
|
|
fail-fast: true
|
|
uses: ./.github/workflows/build-vault-oss.yml
|
|
with:
|
|
create-packages: false
|
|
goarch: ${{ matrix.goarch }}
|
|
goos: ${{ matrix.goos }}
|
|
go-tags: ui netcgo
|
|
go-version: ${{ needs.product-metadata.outputs.go-version }}
|
|
package-name: ${{ needs.product-metadata.outputs.package-name }}
|
|
vault-version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
secrets: inherit
|
|
|
|
build-docker:
|
|
name: Build Vault Docker
|
|
needs:
|
|
- product-metadata
|
|
- build-linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [arm, arm64, 386, amd64]
|
|
env:
|
|
repo: ${{ github.event.repository.name }}
|
|
version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: hashicorp/actions-docker-build@v1
|
|
with:
|
|
version: ${{ env.version }}
|
|
target: default
|
|
arch: ${{ matrix.arch }}
|
|
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
|
|
tags: |
|
|
docker.io/hashicorp/${{ env.repo }}:${{ env.version }}
|
|
public.ecr.aws/hashicorp/${{ env.repo }}:${{ env.version }}
|
|
|
|
build-ubi:
|
|
name: Build Vault Red Hat UBI
|
|
needs:
|
|
- product-metadata
|
|
- build-linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64]
|
|
env:
|
|
repo: ${{ github.event.repository.name }}
|
|
version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: hashicorp/actions-docker-build@v1
|
|
with:
|
|
version: ${{ env.version }}
|
|
target: ubi
|
|
arch: ${{ matrix.arch }}
|
|
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
|
|
redhat_tag: quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ env.version }}-ubi
|
|
|
|
test:
|
|
name: Test ${{ matrix.build-artifact-name }}
|
|
# Only run the Enos workflow against branches that are created from the
|
|
# hashicorp/vault repository. This has the effect of limiting execution of
|
|
# Enos scenarios to branches that originate from authors that have write
|
|
# access to hashicorp/vault repository. This is required as Github Actions
|
|
# will not populate the required secrets for branches created by outside
|
|
# contributors in order to protect the secrets integrity.
|
|
if: "! github.event.pull_request.head.repo.fork"
|
|
needs:
|
|
- product-metadata
|
|
- build-linux
|
|
uses: ./.github/workflows/enos-run.yml
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- matrix-file-name: build-github-oss-linux-amd64-zip
|
|
build-artifact-name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_amd64.zip
|
|
- matrix-file-name: build-github-oss-linux-arm64-zip
|
|
build-artifact-name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_arm64.zip
|
|
with:
|
|
build-artifact-name: ${{ matrix.build-artifact-name }}
|
|
matrix-file-name: ${{ matrix.matrix-file-name }}
|
|
matrix-test-group: ${{ needs.product-metadata.outputs.matrix-test-group }}
|
|
vault-edition: oss
|
|
vault-revision: ${{ needs.product-metadata.outputs.vault-revision }}
|
|
secrets: inherit
|
|
|
|
test-docker-k8s:
|
|
name: Test Docker K8s
|
|
# Only run the Enos workflow against branches that are created from the
|
|
# hashicorp/vault repository. This has the effect of limiting execution of
|
|
# Enos scenarios to branches that originate from authors that have write
|
|
# access to hashicorp/vault repository. This is required as Github Actions
|
|
# will not populate the required secrets for branches created by outside
|
|
# contributors in order to protect the secrets integrity.
|
|
if: "! github.event.pull_request.head.repo.fork"
|
|
needs:
|
|
- product-metadata
|
|
- build-docker
|
|
uses: ./.github/workflows/enos-run-k8s.yml
|
|
with:
|
|
artifact-build-date: ${{ needs.product-metadata.outputs.build-date }}
|
|
artifact-name: ${{ github.event.repository.name }}_default_linux_amd64_${{ needs.product-metadata.outputs.vault-version }}_${{ needs.product-metadata.outputs.vault-revision }}.docker.tar
|
|
artifact-revision: ${{ needs.product-metadata.outputs.vault-revision }}
|
|
artifact-version: ${{ needs.product-metadata.outputs.vault-version }}
|
|
secrets: inherit
|
|
|
|
completed-successfully:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-other
|
|
- build-linux
|
|
- build-darwin
|
|
- build-docker
|
|
- build-ubi
|
|
- test
|
|
- test-docker-k8s
|
|
steps:
|
|
- run: echo "All build and test workflows have succeeded!"
|