[QT-470] Normalize and simplify container build workflows (#18900)

* [QT-470] Normalize and simplify container build workflows

Signed-off-by: Ryan Cragun <me@ryan.ec>
This commit is contained in:
Ryan Cragun 2023-01-30 14:01:51 -08:00 committed by GitHub
parent b737777f15
commit 119e2274fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,9 +9,6 @@ on:
- main - main
- release/** - release/**
env:
PKG_NAME: vault
jobs: jobs:
product-metadata: product-metadata:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -37,7 +34,7 @@ jobs:
echo "build-date=$(make ci-get-date)" >> $GITHUB_OUTPUT echo "build-date=$(make ci-get-date)" >> $GITHUB_OUTPUT
echo "go-version=$(cat ./.go-version)" >> $GITHUB_OUTPUT echo "go-version=$(cat ./.go-version)" >> $GITHUB_OUTPUT
echo "matrix-test-group=$(make ci-get-matrix-group-id)" >> $GITHUB_OUTPUT echo "matrix-test-group=$(make ci-get-matrix-group-id)" >> $GITHUB_OUTPUT
echo "package-name=${{ env.PKG_NAME }}" >> $GITHUB_OUTPUT echo "package-name=vault" >> $GITHUB_OUTPUT
echo "vault-base-version=$(make ci-get-version-base)" >> $GITHUB_OUTPUT echo "vault-base-version=$(make ci-get-version-base)" >> $GITHUB_OUTPUT
echo "vault-revision=$(make ci-get-revision)" >> $GITHUB_OUTPUT echo "vault-revision=$(make ci-get-revision)" >> $GITHUB_OUTPUT
echo "vault-version=$(make ci-get-version)" >> $GITHUB_OUTPUT echo "vault-version=$(make ci-get-version)" >> $GITHUB_OUTPUT
@ -53,7 +50,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
build-other: build-other:
name: Build Vault Other name: Other
needs: product-metadata needs: product-metadata
strategy: strategy:
matrix: matrix:
@ -79,7 +76,7 @@ jobs:
secrets: inherit secrets: inherit
build-linux: build-linux:
name: Build Vault Linux name: Linux
needs: product-metadata needs: product-metadata
strategy: strategy:
matrix: matrix:
@ -97,7 +94,7 @@ jobs:
secrets: inherit secrets: inherit
build-darwin: build-darwin:
name: Build Vault Darwin name: Darwin
needs: product-metadata needs: product-metadata
strategy: strategy:
matrix: matrix:
@ -116,7 +113,7 @@ jobs:
secrets: inherit secrets: inherit
build-docker: build-docker:
name: Build Vault Docker name: Docker image
needs: needs:
- product-metadata - product-metadata
- build-linux - build-linux
@ -124,23 +121,20 @@ jobs:
strategy: strategy:
matrix: matrix:
arch: [arm, arm64, 386, amd64] arch: [arm, arm64, 386, amd64]
env:
repo: ${{ github.event.repository.name }}
version: ${{ needs.product-metadata.outputs.vault-version }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: hashicorp/actions-docker-build@v1 - uses: hashicorp/actions-docker-build@v1
with: with:
version: ${{ env.version }} version: ${{ needs.product-metadata.outputs.vault-version }}
target: default target: default
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip zip_artifact_name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
tags: | tags: |
docker.io/hashicorp/${{ env.repo }}:${{ env.version }} docker.io/hashicorp/${{ github.event.repository.name }}:${{ needs.product-metadata.outputs.vault-version }}
public.ecr.aws/hashicorp/${{ env.repo }}:${{ env.version }} public.ecr.aws/hashicorp/${{ github.event.repository.name }}:${{ needs.product-metadata.outputs.vault-version }}
build-ubi: build-ubi:
name: Build Vault Red Hat UBI name: UBI image
needs: needs:
- product-metadata - product-metadata
- build-linux - build-linux
@ -148,18 +142,15 @@ jobs:
strategy: strategy:
matrix: matrix:
arch: [amd64] arch: [amd64]
env:
repo: ${{ github.event.repository.name }}
version: ${{ needs.product-metadata.outputs.vault-version }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: hashicorp/actions-docker-build@v1 - uses: hashicorp/actions-docker-build@v1
with: with:
version: ${{ env.version }} version: ${{ needs.product-metadata.outputs.vault-version }}
target: ubi target: ubi
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip zip_artifact_name: vault_${{ needs.product-metadata.outputs.vault-version }}_linux_${{ matrix.arch }}.zip
redhat_tag: quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ env.version }}-ubi redhat_tag: quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ needs.product-metadata.outputs.vault-version }}-ubi
test: test:
name: Test ${{ matrix.build-artifact-name }} name: Test ${{ matrix.build-artifact-name }}
@ -222,4 +213,4 @@ jobs:
- test - test
- test-docker-k8s - test-docker-k8s
steps: steps:
- run: echo "All build and test workflows have succeeded!" - run: echo "All required build and test workflows have succeeded!"