RHEL build test

This commit is contained in:
Alexey Pustovalov 2024-02-15 20:01:02 +09:00
parent 290d5740c7
commit 2491b30741

View File

@ -57,6 +57,7 @@ jobs:
contents: read contents: read
outputs: outputs:
platforms: ${{ steps.platform_list.outputs.list }} platforms: ${{ steps.platform_list.outputs.list }}
database: ${{ steps.database.outputs.list }}
components: ${{ steps.components.outputs.list }} components: ${{ steps.components.outputs.list }}
is_default_branch: ${{ steps.branch_info.outputs.is_default_branch }} is_default_branch: ${{ steps.branch_info.outputs.is_default_branch }}
current_branch: ${{ steps.branch_info.outputs.current_branch }} current_branch: ${{ steps.branch_info.outputs.current_branch }}
@ -99,6 +100,19 @@ jobs:
echo "list=$platform_list" >> $GITHUB_OUTPUT echo "list=$platform_list" >> $GITHUB_OUTPUT
- name: Prepare Database engine list
id: database
env:
MATRIX_FILE: ${{ env.MATRIX_FILE }}
run: |
database_list=$(jq -r '[.components | map_values(select(.rhel == true)) | values[].base ] | sort | unique | del(.. | select ( . == "" ) ) | @json' "$MATRIX_FILE")
echo "::group::Database List"
echo "$database_list"
echo "::endgroup::"
echo "list=$database_list" >> $GITHUB_OUTPUT
- name: Prepare Zabbix component list - name: Prepare Zabbix component list
id: components id: components
env: env:
@ -273,7 +287,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
build: [build-mysql, build-sqlite3] build: ${{ fromJson(needs.init_build.outputs.database) }}
arch: ${{ fromJson(needs.init_build.outputs.platforms) }} arch: ${{ fromJson(needs.init_build.outputs.platforms) }}
runs-on: [self-hosted, linux, "${{ matrix.arch }}"] runs-on: [self-hosted, linux, "${{ matrix.arch }}"]
permissions: permissions:
@ -448,6 +462,7 @@ jobs:
- name: Detect Build Base Image - name: Detect Build Base Image
id: build_base_image id: build_base_image
if: ${{ matrix.build != 'snmptraps' }}
env: env:
MATRIX_BUILD: ${{ matrix.build }} MATRIX_BUILD: ${{ matrix.build }}
MATRIX_FILE: ${{ env.MATRIX_FILE }} MATRIX_FILE: ${{ env.MATRIX_FILE }}
@ -471,6 +486,7 @@ jobs:
- name: Pull ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.arch }} image - name: Pull ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.arch }} image
id: base_build id: base_build
if: ${{ matrix.build != 'snmptraps' }}
env: env:
MATRIX_ARCH: ${{ matrix.arch }} MATRIX_ARCH: ${{ matrix.arch }}
BASE_IMAGE: ${{ steps.build_base_image.outputs.build_base }} BASE_IMAGE: ${{ steps.build_base_image.outputs.build_base }}
@ -607,18 +623,21 @@ jobs:
echo "podman rmi -i -f \"${IMAGE_TAG}\"" echo "podman rmi -i -f \"${IMAGE_TAG}\""
podman rmi -i -f "${IMAGE_TAG}" || true podman rmi -i -f "${IMAGE_TAG}" || true
echo "buildah rm -a"
buildah rm -a || true buildah rm -a || true
echo "podman system prune --external"
podman system prune --external podman system prune --external
echo "podman system prune -a --volumes -f"
podman system prune -a --volumes -f podman system prune -a --volumes -f
echo "podman system reset"
podman system reset -f 2>/dev/null || true podman system reset -f 2>/dev/null || true
#rm -rf /home/podman/.local/share/containers/
echo "::endgroup::" echo "::endgroup::"
clean_artifacts: clean_artifacts:
timeout-minutes: 90 timeout-minutes: 90
needs: [ "build_images", "init_build"] needs: ${{ fromJson(needs.init_build.outputs.database) }}
name: Build ${{ matrix.build }} image (${{ matrix.arch }}) name: Clear ${{ matrix.build }} image cache (${{ matrix.arch }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -632,7 +651,6 @@ jobs:
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with: with:
path: | path: |
${{ matrix.build }}_${{ matrix.arch }}_digest
${{ matrix.build }}_${{ matrix.arch }}_tag_id ${{ matrix.build }}_${{ matrix.arch }}_tag_id
${{ matrix.build }}_${{ matrix.arch }}_tag ${{ matrix.build }}_${{ matrix.arch }}_tag
key: ${{ matrix.build }}-${{ matrix.arch }}-${{ github.run_id }} key: ${{ matrix.build }}-${{ matrix.arch }}-${{ github.run_id }}
@ -643,14 +661,14 @@ jobs:
BASE_IMAGE: ${{ matrix.build }} BASE_IMAGE: ${{ matrix.build }}
IMAGE_DIR: ${{ env.IMAGE_DIR }} IMAGE_DIR: ${{ env.IMAGE_DIR }}
run: | run: |
BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_digest") BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_tag_id")
rm -rf "${IMAGE_DIR}/${BASE_TAG}" rm -rf "${IMAGE_DIR}/${BASE_TAG}"
- name: Download SHA256 tag of ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} - name: Download SHA256 tag of ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }}
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with: with:
path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_digest path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_tag_id
key: ${{ env.BASE_BUILD_NAME }}-${{ matrix.arch }}-${{ github.run_id }} key: ${{ env.BASE_BUILD_NAME }}-${{ matrix.arch }}-${{ github.run_id }}
@ -660,6 +678,6 @@ jobs:
BASE_IMAGE: ${{ env.BASE_BUILD_NAME }} BASE_IMAGE: ${{ env.BASE_BUILD_NAME }}
IMAGE_DIR: ${{ env.IMAGE_DIR }} IMAGE_DIR: ${{ env.IMAGE_DIR }}
run: | run: |
BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_digest") BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_tag_id")
rm -rf "${IMAGE_DIR}/${BASE_TAG}" rm -rf "${IMAGE_DIR}/${BASE_TAG}"