mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-05-31 23:26:16 +02:00
Prepare universal workflow
This commit is contained in:
parent
fe8433aba3
commit
757e8d9d10
26
.github/workflows/images_build_windows.yml
vendored
26
.github/workflows/images_build_windows.yml
vendored
@ -120,6 +120,7 @@ jobs:
|
|||||||
needs: init_build
|
needs: init_build
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
id-token: write
|
||||||
env:
|
env:
|
||||||
BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
||||||
strategy:
|
strategy:
|
||||||
@ -174,7 +175,7 @@ jobs:
|
|||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
|
|
||||||
- name: Build image
|
- name: Build and push image
|
||||||
id: docker_build
|
id: docker_build
|
||||||
env:
|
env:
|
||||||
DOCKERFILES_DIRECTORY: ${{ env.DOCKERFILES_DIRECTORY }}
|
DOCKERFILES_DIRECTORY: ${{ env.DOCKERFILES_DIRECTORY }}
|
||||||
@ -185,6 +186,7 @@ jobs:
|
|||||||
BASE_OS_TAG: ${{ steps.base_os_tag.outputs.os_tag }}
|
BASE_OS_TAG: ${{ steps.base_os_tag.outputs.os_tag }}
|
||||||
LABEL_REVISION: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
LABEL_REVISION: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
LABEL_CREATED: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
LABEL_CREATED: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||||
|
AUTO_PUSH_IMAGES: ${{ env.AUTO_PUSH_IMAGES }}
|
||||||
run: |
|
run: |
|
||||||
$context="$Env:DOCKERFILES_DIRECTORY\$Env:BASE_BUILD_NAME\windows\"
|
$context="$Env:DOCKERFILES_DIRECTORY\$Env:BASE_BUILD_NAME\windows\"
|
||||||
$dockerfile= $context + 'Dockerfile.' + $Env:MATRIX_COMPONENT
|
$dockerfile= $context + 'Dockerfile.' + $Env:MATRIX_COMPONENT
|
||||||
@ -196,6 +198,7 @@ jobs:
|
|||||||
$tags=$( $tags_array | Foreach-Object { "--tag=$_" } )
|
$tags=$( $tags_array | Foreach-Object { "--tag=$_" } )
|
||||||
|
|
||||||
echo "docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION --label org.opencontainers.image.created=$Env:LABEL_CREATED --build-arg=BUILD_BASE_IMAGE=$base_os_image --file=$dockerfile $tags $context"
|
echo "docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION --label org.opencontainers.image.created=$Env:LABEL_CREATED --build-arg=BUILD_BASE_IMAGE=$base_os_image --file=$dockerfile $tags $context"
|
||||||
|
echo "$Env:AUTO_PUSH_IMAGES"
|
||||||
|
|
||||||
docker pull $base_os_image
|
docker pull $base_os_image
|
||||||
|
|
||||||
@ -207,24 +210,17 @@ jobs:
|
|||||||
$context
|
$context
|
||||||
if (-not $?) {throw "Failed"}
|
if (-not $?) {throw "Failed"}
|
||||||
|
|
||||||
$digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1]
|
|
||||||
if (-not $?) {throw "Failed"}
|
|
||||||
|
|
||||||
echo "digest=$digest" >> $Env:GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Push image
|
|
||||||
if: ${{ env.AUTO_PUSH_IMAGES }}
|
|
||||||
env:
|
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
|
||||||
run: |
|
|
||||||
$tags_array=$( "$Env:TAGS".Split("`n") )
|
|
||||||
|
|
||||||
Foreach ($tag in $tags_array) {
|
Foreach ($tag in $tags_array) {
|
||||||
echo "docker image push $tag"
|
echo "docker image push $tag"
|
||||||
docker image push $tag
|
docker image push $tag
|
||||||
if (-not $?) {throw "Failed"}
|
if (-not $?) {throw "Failed"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1]
|
||||||
|
if (-not $?) {throw "Failed"}
|
||||||
|
|
||||||
|
echo "digest=$digest" >> $Env:GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Sign the images with GitHub OIDC Token
|
- name: Sign the images with GitHub OIDC Token
|
||||||
env:
|
env:
|
||||||
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
DIGEST: ${{ steps.docker_build.outputs.digest }}
|
||||||
@ -257,6 +253,7 @@ jobs:
|
|||||||
name: Build ${{ matrix.component }} sources on ${{ matrix.os }}
|
name: Build ${{ matrix.component }} sources on ${{ matrix.os }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
id-token: write
|
||||||
env:
|
env:
|
||||||
BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
||||||
COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
||||||
@ -381,6 +378,9 @@ jobs:
|
|||||||
timeout-minutes: 70
|
timeout-minutes: 70
|
||||||
needs: [ "build_components", "init_build"]
|
needs: [ "build_components", "init_build"]
|
||||||
name: Build ${{ matrix.component }} on ${{ matrix.os }}
|
name: Build ${{ matrix.component }} on ${{ matrix.os }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
env:
|
env:
|
||||||
COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX: "_${{ matrix.os }}_${{ matrix.component }}"
|
||||||
strategy:
|
strategy:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user