mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-02-02 19:09:21 +01:00
Prepare universal workflow
This commit is contained in:
parent
fa647a4e36
commit
ab1cb4269b
41
.github/workflows/images_build.yml
vendored
41
.github/workflows/images_build.yml
vendored
@ -23,9 +23,14 @@ defaults:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
AUTO_PUSH_IMAGES: ${{ secrets.AUTO_PUSH_IMAGES }}
|
||||||
|
|
||||||
DOCKER_REPOSITORY: "zabbix"
|
DOCKER_REPOSITORY: "zabbix"
|
||||||
LATEST_BRANCH: ${{ github.event.repository.default_branch }}
|
LATEST_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
|
IMAGE_PREFIX: "zabbix-"
|
||||||
|
|
||||||
BASE_BUILD_NAME: "build-base"
|
BASE_BUILD_NAME: "build-base"
|
||||||
|
|
||||||
MATRIX_FILE: "build.json"
|
MATRIX_FILE: "build.json"
|
||||||
DOCKERFILES_DIRECTORY: "./Dockerfiles"
|
DOCKERFILES_DIRECTORY: "./Dockerfiles"
|
||||||
|
|
||||||
@ -60,7 +65,7 @@ jobs:
|
|||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
sparse-checkout: ${{ env.MATRIX_FILE }}
|
sparse-checkout: ${{ env.MATRIX_FILE }}
|
||||||
|
|
||||||
- name: Check build.json file
|
- name: Check ${{ env.MATRIX_FILE }} file
|
||||||
id: build_exists
|
id: build_exists
|
||||||
env:
|
env:
|
||||||
MATRIX_FILE: ${{ env.MATRIX_FILE }}
|
MATRIX_FILE: ${{ env.MATRIX_FILE }}
|
||||||
@ -77,6 +82,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
os_list=$(jq -r '.["os-linux"] | keys | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
os_list=$(jq -r '.["os-linux"] | keys | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
||||||
|
|
||||||
|
echo "::group::Operating System List"
|
||||||
|
echo "$os_list"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "list=$os_list" >> $GITHUB_OUTPUT
|
echo "list=$os_list" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Prepare Platform list
|
- name: Prepare Platform list
|
||||||
@ -86,6 +95,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
platform_list=$(jq -r '.["os-linux"] | tostring | @json' "$MATRIX_FILE")
|
platform_list=$(jq -r '.["os-linux"] | tostring | @json' "$MATRIX_FILE")
|
||||||
|
|
||||||
|
echo "::group::Platform List"
|
||||||
|
echo "$platform_list"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "list=$platform_list" >> $GITHUB_OUTPUT
|
echo "list=$platform_list" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Prepare Database engine list
|
- name: Prepare Database engine list
|
||||||
@ -95,6 +108,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
database_list=$(jq -r '[.components | values[] ] | sort | unique | del(.. | select ( . == "" ) ) | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
database_list=$(jq -r '[.components | values[] ] | sort | unique | del(.. | select ( . == "" ) ) | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
||||||
|
|
||||||
|
echo "::group::Database List"
|
||||||
|
echo "$database_list"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "list=$database_list" >> $GITHUB_OUTPUT
|
echo "list=$database_list" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Prepare Zabbix component list
|
- name: Prepare Zabbix component list
|
||||||
@ -104,6 +121,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
component_list=$(jq -r '.components | keys | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
component_list=$(jq -r '.components | keys | [ .[] | tostring ] | @json' "$MATRIX_FILE")
|
||||||
|
|
||||||
|
echo "::group::Zabbix Component List"
|
||||||
|
echo "$component_list"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "list=$component_list" >> $GITHUB_OUTPUT
|
echo "list=$component_list" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Get branch info
|
- name: Get branch info
|
||||||
@ -113,6 +134,7 @@ jobs:
|
|||||||
github_ref: ${{ github.ref }}
|
github_ref: ${{ github.ref }}
|
||||||
run: |
|
run: |
|
||||||
result=false
|
result=false
|
||||||
|
sha_short=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
if [[ "$github_ref" == "refs/tags/"* ]]; then
|
if [[ "$github_ref" == "refs/tags/"* ]]; then
|
||||||
github_ref=${github_ref%.*}
|
github_ref=${github_ref%.*}
|
||||||
@ -124,9 +146,15 @@ jobs:
|
|||||||
result=true
|
result=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "::group::Branch data"
|
||||||
|
echo "is_default_branch - $result"
|
||||||
|
echo "current_branch - $github_ref"
|
||||||
|
echo "sha_short - $sha_short"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "is_default_branch=$result" >> $GITHUB_OUTPUT
|
echo "is_default_branch=$result" >> $GITHUB_OUTPUT
|
||||||
echo "current_branch=$github_ref" >> $GITHUB_OUTPUT
|
echo "current_branch=$github_ref" >> $GITHUB_OUTPUT
|
||||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "sha_short=$sha_short" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build_base:
|
build_base:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
@ -232,7 +260,7 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ env.BASE_BUILD_NAME }}
|
images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.BASE_BUILD_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},prefix=${{ matrix.os }}-
|
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},prefix=${{ matrix.os }}-
|
||||||
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},suffix=-${{ matrix.os }}
|
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},suffix=-${{ matrix.os }}
|
||||||
@ -270,6 +298,7 @@ jobs:
|
|||||||
for tag in ${TAGS}; do
|
for tag in ${TAGS}; do
|
||||||
images+="${tag}@${DIGEST} "
|
images+="${tag}@${DIGEST} "
|
||||||
done
|
done
|
||||||
|
echo "$images"
|
||||||
cosign sign --yes ${images}
|
cosign sign --yes ${images}
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
@ -277,7 +306,13 @@ jobs:
|
|||||||
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
||||||
CACHE_FILE_NAME: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}
|
CACHE_FILE_NAME: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}
|
||||||
run: |
|
run: |
|
||||||
|
echo "::group::Image digest"
|
||||||
echo "$DIGEST"
|
echo "$DIGEST"
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo "::group::Cache file name"
|
||||||
|
echo "$CACHE_FILE_NAME"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "$DIGEST" > "$CACHE_FILE_NAME"
|
echo "$DIGEST" > "$CACHE_FILE_NAME"
|
||||||
|
|
||||||
- name: Cache image digest
|
- name: Cache image digest
|
||||||
|
Loading…
Reference in New Issue
Block a user