Prepare universal workflow

This commit is contained in:
Alexey Pustovalov 2024-02-11 17:10:18 +09:00
parent eab2348fc5
commit 87b28015ec

View File

@ -24,6 +24,7 @@ env:
REGISTRY: "quay.io"
REGISTRY_NAMESPACE: "redhat-isv-containers"
PREFLIGHT_IMAGE: "quay.io/opdev/preflight:stable"
PFLT_LOGLEVEL: "warn"
PFLT_ARTIFACTS: "/tmp/artifacts"
@ -415,8 +416,14 @@ jobs:
PFLT_ARTIFACTS: ${{ env.PFLT_ARTIFACTS }}
PFLT_LOGLEVEL: ${{ env.PFLT_LOGLEVEL }}
IMAGE_TAG: ${{ steps.build_image.outputs.image-with-tag }}
PREFLIGHT_IMAGE: ${{ env.PREFLIGHT_IMAGE }}
run: |
mkdir -p $PFLT_ARTIFACTS
echo "::group::Pull preflight image"
podman pull "$PREFLIGHT_IMAGE"
echo "::endgroup::"
echo "::group::Perform certification tests"
podman run \
-it \
--rm \
@ -429,7 +436,9 @@ jobs:
--env PFLT_DOCKERCONFIG=/temp-authfile.json \
-v $PFLT_ARTIFACTS:/artifacts \
-v $PFLT_DOCKERCONFIG:/temp-authfile.json:ro \
quay.io/opdev/preflight:stable check container $IMAGE_TAG --submit
"$PREFLIGHT_IMAGE" check container $IMAGE_TAG --submit
podman rmi -i -f "$PREFLIGHT_IMAGE"
echo "::endgroup::"
- name: Push to RedHat certification procedure
id: push_to_registry_all_tags
@ -440,9 +449,16 @@ jobs:
- name: Cleanup artifacts
if: ${{ always() }}
env:
PREFLIGHT_IMAGE: ${{ env.PREFLIGHT_IMAGE }}
PFLT_ARTIFACTS: ${{ env.PFLT_ARTIFACTS }}
TAGS: ${{ steps.meta.outputs.tags }}
run: |
echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r image_name ; do podman rmi -i -f $image_name; done
rm -rf ${{ env.PFLT_ARTIFACTS }}
echo "::group::Post build actions"
echo "$TAGS" | while IFS= read -r image_name ; do podman rmi -i -f "$image_name"; done
rm -rf "$PFLT_ARTIFACTS"
podman rmi -i -f "$PREFLIGHT_IMAGE"
echo "::endgroup::"
clean_artifacts:
timeout-minutes: 90
@ -451,22 +467,22 @@ jobs:
strategy:
fail-fast: false
matrix:
build: [mysql, sqlite3]
build: [build-mysql, build-sqlite3]
arch: [X64, ARM64]
runs-on: [self-hosted, linux, "${{ matrix.arch }}"]
if: ${{ always() && needs.build_base_database.result == 'success' }}
permissions: {}
steps:
- name: Download SHA256 tag of build-${{ matrix.build }}:${{ matrix.arch }}
- name: Download SHA256 tag of ${{ matrix.build }}:${{ matrix.arch }}
uses: actions/cache@v4
with:
path: build_${{ matrix.build }}_${{ matrix.arch }}
key: build-${{ matrix.build }}-${{ matrix.arch }}-${{ github.run_id }}
path: ${{ matrix.build }}_${{ matrix.arch }}
key: ${{ matrix.build }}-${{ matrix.arch }}-${{ github.run_id }}
- name: Remove build-${{ matrix.build }}:${{ matrix.arch }} SHA256 tag
- name: Remove ${{ matrix.build }}:${{ matrix.arch }} SHA256 tag
env:
MATRIX_ARCH: ${{ matrix.arch }}
BASE_IMAGE: build_${{ matrix.build }}
BASE_IMAGE: ${{ matrix.build }}
IMAGES_PREFIX: ${{ env.IMAGES_PREFIX }}
run: |
BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}")
@ -482,7 +498,6 @@ jobs:
- name: Remove ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} SHA256 tag
if: ${{ matrix.build == 'mysql' }}
env:
MATRIX_ARCH: ${{ matrix.arch }}
BASE_IMAGE: ${{ env.BASE_BUILD_NAME }}