mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-05-30 06:40:22 +02:00
Updated building images workflow
This commit is contained in:
parent
03da059ae2
commit
970aaa2e57
57
.github/workflows/images_build.yml
vendored
57
.github/workflows/images_build.yml
vendored
@ -583,18 +583,6 @@ jobs:
|
|||||||
"$BASE_IMAGE"
|
"$BASE_IMAGE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Download metadata of ${{ env.BASE_BUILD_NAME }}:${{ matrix.os }}
|
|
||||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-base-cache
|
|
||||||
key: ${{ env.BASE_BUILD_NAME }}-${{ matrix.os }}-${{ github.run_id }}-image
|
|
||||||
|
|
||||||
- name: Download metadata of ${{ matrix.build }}:${{ matrix.os }}
|
|
||||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-build-cache
|
|
||||||
key: ${{ matrix.build }}-${{ matrix.os }}-${{ github.run_id }}-image
|
|
||||||
|
|
||||||
- name: Prepare cache data
|
- name: Prepare cache data
|
||||||
id: cache_data
|
id: cache_data
|
||||||
env:
|
env:
|
||||||
@ -679,21 +667,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
env:
|
env:
|
||||||
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
CACHE_FILE_NAME: "base_build_image_metadata.json"
|
||||||
CACHE_FILE_NAME: ${{ matrix.build }}_${{ matrix.os }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Image digest"
|
echo "::group::Image metadata"
|
||||||
echo "$DIGEST"
|
echo "${METADATA}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
echo "::group::Cache file name"
|
echo "::group::Cache file name"
|
||||||
echo "$CACHE_FILE_NAME"
|
echo "${CACHE_FILE_NAME}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
echo "$DIGEST" > $CACHE_FILE_NAME
|
|
||||||
|
echo "${METADATA}" > "$CACHE_FILE_NAME"
|
||||||
|
|
||||||
- name: Caching SHA256 tag of the image
|
- name: Caching SHA256 tag of the image
|
||||||
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||||
with:
|
with:
|
||||||
path: ${{ matrix.build }}_${{ matrix.os }}
|
path: "base_build_image_metadata.json"
|
||||||
key: ${{ matrix.build }}-${{ matrix.os }}-${{ github.run_id }}
|
key: ${{ matrix.build }}-${{ matrix.os }}-${{ github.run_id }}
|
||||||
|
|
||||||
build_images:
|
build_images:
|
||||||
@ -928,7 +916,7 @@ jobs:
|
|||||||
type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,suffix=-${{ matrix.os }}-latest
|
type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,suffix=-${{ matrix.os }}-latest
|
||||||
type=raw,enable=${{ (needs.init_build.outputs.current_branch != 'trunk') && (needs.init_build.outputs.is_default_branch == 'true') }},value=${{matrix.os}}-latest
|
type=raw,enable=${{ (needs.init_build.outputs.current_branch != 'trunk') && (needs.init_build.outputs.is_default_branch == 'true') }},value=${{matrix.os}}-latest
|
||||||
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,prefix=${{ matrix.os }}-
|
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,prefix=${{ matrix.os }}-
|
||||||
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,suffix=-${{ matrix.os }}
|
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' || contains(fromJSON('["workflow_dispatch"]'), github.event_name) }},event=branch,suffix=-${{ matrix.os }}
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=${{ (matrix.os == 'alpine') && (!contains(fromJSON('["workflow_dispatch"]'), github.event_name)) && ( needs.init_build.outputs.is_default_branch == 'true' ) }}
|
latest=${{ (matrix.os == 'alpine') && (!contains(fromJSON('["workflow_dispatch"]'), github.event_name)) && ( needs.init_build.outputs.is_default_branch == 'true' ) }}
|
||||||
|
|
||||||
@ -936,28 +924,21 @@ jobs:
|
|||||||
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||||
if: ${{ matrix.build != 'snmptraps' }}
|
if: ${{ matrix.build != 'snmptraps' }}
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.build_base_image.outputs.build_base }}_${{ matrix.os }}
|
path: "base_build_image_metadata.json"
|
||||||
key: ${{ steps.build_base_image.outputs.build_base }}-${{ matrix.os }}-${{ github.run_id }}
|
key: ${{ steps.build_base_image.outputs.build_base }}-${{ matrix.os }}-${{ github.run_id }}
|
||||||
|
|
||||||
- name: Retrieve ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} SHA256 tag
|
- name: Retrieve ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} SHA256 tag
|
||||||
id: base_build
|
id: base_build
|
||||||
if: ${{ matrix.build != 'snmptraps' }}
|
if: ${{ matrix.build != 'snmptraps' }}
|
||||||
env:
|
|
||||||
BUILD_BASE: ${{ steps.build_base_image.outputs.build_base }}
|
|
||||||
MATRIX_OS: ${{ matrix.os }}
|
|
||||||
DOCKER_REPOSITORY: ${{ env.AUTO_PUSH_IMAGES != 'true' && 'ghcr.io/' }}${{ env.AUTO_PUSH_IMAGES == 'true' && env.DOCKER_REPOSITORY || env.DOCKER_REGISTRY_TEST }}
|
|
||||||
IMAGES_PREFIX: ${{ env.IMAGES_PREFIX }}
|
|
||||||
run: |
|
run: |
|
||||||
BASE_TAG=$(cat "${BUILD_BASE}_${MATRIX_OS}")
|
echo "::group::Base build image metadata"
|
||||||
BUILD_BASE_IMAGE=${DOCKER_REPOSITORY}/${IMAGES_PREFIX}${BUILD_BASE}@${BASE_TAG}
|
cat "base_build_image_metadata.json"
|
||||||
|
|
||||||
echo "::group::Base build image information"
|
|
||||||
echo "base_tag=${BASE_TAG}"
|
|
||||||
echo "base_build_image=${BUILD_BASE_IMAGE}"
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "base_tag=${BASE_TAG}" >> $GITHUB_OUTPUT
|
IMAGE_DIGEST=$(jq -r '."containerimage.digest"' "base_image_metadata.json")
|
||||||
echo "base_build_image=${BUILD_BASE_IMAGE}" >> $GITHUB_OUTPUT
|
IMAGE_NAME=$(jq -r '."image.name"' "base_image_metadata.json" | cut -d: -f1)
|
||||||
|
|
||||||
|
echo "base_build_image=${IMAGE_NAME}@${IMAGE_DIGEST}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Verify ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} cosign
|
- name: Verify ${{ steps.build_base_image.outputs.build_base }}:${{ matrix.os }} cosign
|
||||||
if: ${{ matrix.build != 'snmptraps' && env.AUTO_PUSH_IMAGES == 'true' }}
|
if: ${{ matrix.build != 'snmptraps' && env.AUTO_PUSH_IMAGES == 'true' }}
|
||||||
@ -1031,10 +1012,10 @@ jobs:
|
|||||||
cosign sign --yes ${images}
|
cosign sign --yes ${images}
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image metadata
|
||||||
env:
|
env:
|
||||||
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
METADATA: ${{ steps.docker_build.outputs.metadata }}
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Image digest"
|
echo "::group::Image metadata"
|
||||||
echo "$DIGEST"
|
echo "${METADATA}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user