2022-11-18 21:43:55 +00:00
|
|
|
---
|
2021-12-06 16:06:22 +00:00
|
|
|
name: build
|
|
|
|
|
2022-06-06 15:47:55 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-11-11 20:14:43 +00:00
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- release/**
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-08-23 19:53:41 +00:00
|
|
|
product-metadata:
|
2021-12-06 16:06:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2022-11-11 20:14:43 +00:00
|
|
|
build-date: ${{ steps.get-metadata.outputs.build-date }}
|
|
|
|
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
|
|
go-version: ${{ steps.get-metadata.outputs.go-version }}
|
2022-12-12 20:46:04 +00:00
|
|
|
matrix-test-group: ${{ steps.get-metadata.outputs.matrix-test-group }}
|
2022-11-11 20:14:43 +00:00
|
|
|
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 }}
|
2021-12-06 16:06:22 +00:00
|
|
|
steps:
|
2022-08-23 19:53:41 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 20:14:43 +00:00
|
|
|
- name: Get metadata
|
|
|
|
id: get-metadata
|
2022-12-12 20:46:04 +00:00
|
|
|
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
|
2022-04-19 18:28:08 +00:00
|
|
|
run: |
|
2023-03-22 19:02:06 +00:00
|
|
|
# shellcheck disable=SC2129
|
|
|
|
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=vault" >> "$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"
|
2022-11-11 20:14:43 +00:00
|
|
|
- uses: hashicorp/actions-generate-metadata@v1
|
2021-12-06 16:06:22 +00:00
|
|
|
id: generate-metadata-file
|
|
|
|
with:
|
2022-11-11 20:14:43 +00:00
|
|
|
version: ${{ steps.get-metadata.outputs.vault-version }}
|
|
|
|
product: ${{ steps.get-metadata.outputs.package-name }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
2021-12-06 16:06:22 +00:00
|
|
|
with:
|
|
|
|
name: metadata.json
|
|
|
|
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
2022-11-11 20:14:43 +00:00
|
|
|
if-no-files-found: error
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
build-other:
|
2023-01-30 22:01:51 +00:00
|
|
|
name: Other
|
2022-11-11 20:14:43 +00:00
|
|
|
needs: product-metadata
|
2021-12-06 16:06:22 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-11 20:14:43 +00:00
|
|
|
goos: [freebsd, windows, netbsd, openbsd, solaris]
|
|
|
|
goarch: [386, amd64, arm]
|
2021-12-06 16:06:22 +00:00
|
|
|
exclude:
|
|
|
|
- goos: solaris
|
|
|
|
goarch: 386
|
|
|
|
- goos: solaris
|
|
|
|
goarch: arm
|
|
|
|
- goos: windows
|
|
|
|
goarch: arm
|
|
|
|
fail-fast: true
|
2022-11-11 20:14:43 +00:00
|
|
|
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
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
build-linux:
|
2023-01-30 22:01:51 +00:00
|
|
|
name: Linux
|
2022-11-11 20:14:43 +00:00
|
|
|
needs: product-metadata
|
2021-12-06 16:06:22 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
goos: [linux]
|
2022-11-11 20:14:43 +00:00
|
|
|
goarch: [arm, arm64, 386, amd64]
|
2021-12-06 16:06:22 +00:00
|
|
|
fail-fast: true
|
2022-11-11 20:14:43 +00:00
|
|
|
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
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
build-darwin:
|
2023-01-30 22:01:51 +00:00
|
|
|
name: Darwin
|
2022-11-11 20:14:43 +00:00
|
|
|
needs: product-metadata
|
2021-12-06 16:06:22 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-11 20:14:43 +00:00
|
|
|
goos: [darwin]
|
|
|
|
goarch: [amd64, arm64]
|
2021-12-06 16:06:22 +00:00
|
|
|
fail-fast: true
|
2022-11-11 20:14:43 +00:00
|
|
|
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
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
build-docker:
|
2023-01-30 22:01:51 +00:00
|
|
|
name: Docker image
|
2021-12-06 16:06:22 +00:00
|
|
|
needs:
|
2022-08-23 19:53:41 +00:00
|
|
|
- product-metadata
|
2021-12-06 16:06:22 +00:00
|
|
|
- build-linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-11 20:14:43 +00:00
|
|
|
arch: [arm, arm64, 386, amd64]
|
2021-12-06 16:06:22 +00:00
|
|
|
steps:
|
2022-11-11 20:14:43 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: hashicorp/actions-docker-build@v1
|
2021-12-06 16:06:22 +00:00
|
|
|
with:
|
2023-01-30 22:01:51 +00:00
|
|
|
version: ${{ needs.product-metadata.outputs.vault-version }}
|
2021-12-06 16:06:22 +00:00
|
|
|
target: default
|
2022-11-11 20:14:43 +00:00
|
|
|
arch: ${{ matrix.arch }}
|
2023-01-30 22:01:51 +00:00
|
|
|
zip_artifact_name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
|
2021-12-06 16:06:22 +00:00
|
|
|
tags: |
|
2023-01-30 22:01:51 +00:00
|
|
|
docker.io/hashicorp/${{ github.event.repository.name }}:${{ needs.product-metadata.outputs.vault-version }}
|
|
|
|
public.ecr.aws/hashicorp/${{ github.event.repository.name }}:${{ needs.product-metadata.outputs.vault-version }}
|
2022-10-19 18:26:31 +00:00
|
|
|
|
2022-05-13 15:21:15 +00:00
|
|
|
build-ubi:
|
2023-01-30 22:01:51 +00:00
|
|
|
name: UBI image
|
2022-05-13 15:21:15 +00:00
|
|
|
needs:
|
2022-08-23 19:53:41 +00:00
|
|
|
- product-metadata
|
2022-05-13 15:21:15 +00:00
|
|
|
- build-linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-11 20:14:43 +00:00
|
|
|
arch: [amd64]
|
2022-05-13 15:21:15 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-11-11 20:14:43 +00:00
|
|
|
- uses: hashicorp/actions-docker-build@v1
|
2022-05-13 15:21:15 +00:00
|
|
|
with:
|
2023-01-30 22:01:51 +00:00
|
|
|
version: ${{ needs.product-metadata.outputs.vault-version }}
|
2022-05-13 15:21:15 +00:00
|
|
|
target: ubi
|
2022-11-11 20:14:43 +00:00
|
|
|
arch: ${{ matrix.arch }}
|
2023-01-30 22:01:51 +00:00
|
|
|
zip_artifact_name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
|
|
|
|
redhat_tag: quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ needs.product-metadata.outputs.vault-version }}-ubi
|
2022-08-23 19:53:41 +00:00
|
|
|
|
2022-12-12 20:46:04 +00:00
|
|
|
test:
|
|
|
|
name: Test ${{ matrix.build-artifact-name }}
|
2022-08-23 19:53:41 +00:00
|
|
|
# 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
|
2023-01-18 23:37:38 +00:00
|
|
|
uses: ./.github/workflows/test-run-enos-scenario-matrix.yml
|
2022-12-12 20:46:04 +00:00
|
|
|
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
|
2022-08-23 19:53:41 +00:00
|
|
|
with:
|
2022-12-12 20:46:04 +00:00
|
|
|
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 }}
|
2023-01-18 21:09:19 +00:00
|
|
|
ssh-key-name: ${{ github.event.repository.name }}-ci-ssh-key
|
2022-11-11 20:14:43 +00:00
|
|
|
secrets: inherit
|
|
|
|
|
2022-12-12 20:46:04 +00:00
|
|
|
test-docker-k8s:
|
|
|
|
name: Test Docker K8s
|
2022-11-11 20:14:43 +00:00
|
|
|
# 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 }}
|
2022-08-23 19:53:41 +00:00
|
|
|
secrets: inherit
|
2022-11-18 21:43:55 +00:00
|
|
|
|
|
|
|
completed-successfully:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build-other
|
|
|
|
- build-linux
|
|
|
|
- build-darwin
|
|
|
|
- build-docker
|
|
|
|
- build-ubi
|
2022-12-12 20:46:04 +00:00
|
|
|
- test
|
|
|
|
- test-docker-k8s
|
2022-11-18 21:43:55 +00:00
|
|
|
steps:
|
2023-01-30 22:01:51 +00:00
|
|
|
- run: echo "All required build and test workflows have succeeded!"
|