Prepare universal workflow

This commit is contained in:
Alexey Pustovalov 2024-02-10 04:41:00 +09:00
parent bbbb81d61e
commit b018df4502

View File

@ -20,9 +20,9 @@ defaults:
shell: pwsh shell: pwsh
env: env:
AUTO_PUSH_IMAGES: ${{ secrets.AUTO_PUSH_IMAGES }} AUTO_PUSH_IMAGES: ${{ vars.AUTO_PUSH_IMAGES }}
DOCKER_REPOSITORY: "zabbix" DOCKER_REPOSITORY: ${{ vars.DOCKER_REPOSITORY }}
LATEST_BRANCH: ${{ github.event.repository.default_branch }} LATEST_BRANCH: ${{ github.event.repository.default_branch }}
IMAGES_PREFIX: "zabbix-" IMAGES_PREFIX: "zabbix-"
@ -680,21 +680,26 @@ jobs:
# PowerShell images based on LTSC 2019 and LTSC 2016 do not have "ltsc" prefix # PowerShell images based on LTSC 2019 and LTSC 2016 do not have "ltsc" prefix
$os_tag_suffix=$Env:BASE_BUILD_OS_TAG $os_tag_suffix=$Env:BASE_BUILD_OS_TAG
$os_tag_suffix=$os_tag_suffix -replace "ltsc2019",'1809' $os_tag_suffix=$os_tag_suffix -replace "ltsc2019",'1809'
$base_image=$Env:PWSH_BASE_IMAGE_NAME + ':' + $Env:PWSH_BASE_IMAGE_PREFIX + $os_tag_suffix
echo "::group::Image tags" echo "::group::Image tags"
echo "$Env:TAGS" echo "$Env:TAGS"
echo "::endgroup::" echo "::endgroup::"
echo "::group::Pull base image" echo "::group::Pull build base image"
docker pull $base_build_image docker pull $base_build_image
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
echo "::endgroup::" echo "::endgroup::"
echo "::group::Pull Powershell base image"
docker pull $base_image
if (-not $?) {throw "Failed"}
echo "::endgroup::"
echo "::group::Build Image" echo "::group::Build Image"
Write-Host @" Write-Host @"
docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION
--label org.opencontainers.image.created=$Env:LABEL_CREATED --label org.opencontainers.image.created=$Env:LABEL_CREATED
--build-arg=BUILD_BASE_IMAGE=$base_build_image --build-arg=BUILD_BASE_IMAGE=$base_build_image
--build-arg=BASE_IMAGE=$Env:PWSH_BASE_IMAGE_NAME:$Env:PWSH_BASE_IMAGE_PREFIX$os_tag_suffix --build-arg=BASE_IMAGE=$base_image
--file=$dockerfile --file=$dockerfile
$tags $tags
$context $context
@ -703,7 +708,7 @@ jobs:
docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION ` docker build --label org.opencontainers.image.revision=$Env:LABEL_REVISION `
--label org.opencontainers.image.created=$Env:LABEL_CREATED ` --label org.opencontainers.image.created=$Env:LABEL_CREATED `
--build-arg=BUILD_BASE_IMAGE=$base_build_image ` --build-arg=BUILD_BASE_IMAGE=$base_build_image `
--build-arg=BASE_IMAGE=$Env:PWSH_BASE_IMAGE_NAME:$Env:PWSH_BASE_IMAGE_PREFIX$os_tag_suffix ` --build-arg=BASE_IMAGE=$base_image `
--file=$dockerfile ` --file=$dockerfile `
$tags ` $tags `
$context $context