From d8533ca9dc04c7ef7dc8efd1ccba87831ec08761 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 21:36:02 +0900 Subject: [PATCH 01/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 277e2c71e..840da1e57 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -137,13 +137,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("go version") ...'; ` go version; ` ` - Write-Host 'Installing Mingw-w64...'; ` - 7z x $env:TEMP\mingw.7z; ` - compact /c /i /s:$env:SystemDrive\mingw64 | Out-Null; ` - ` - Write-Host 'Verifying install ("gcc -v") ...'; ` - gcc -v; ` - ` Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` cmd /C start /w $env:TEMP\vs_buildtools.exe ` --quiet ` From 9263fba4d97141d4707db842d5dd30c389d761fe Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 22:03:03 +0900 Subject: [PATCH 02/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 840da1e57..5e5fc03e9 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -137,6 +137,21 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("go version") ...'; ` go version; ` ` + Write-Host 'Installing Mingw-w64...'; ` + 7z x $env:TEMP\mingw.7z; ` + ` + Write-Host 'Verifying install ("gcc -v") ...'; ` + gcc -v; ` + ` + Write-Host 'Installing MSYS2...'; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` + sh --login -c 'pacman -Syu --noconfirm'; ` + sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + ` + Write-Host 'Verifying install ("sh --version") ...'; ` + sh.exe --version; ` + ` Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` cmd /C start /w $env:TEMP\vs_buildtools.exe ` --quiet ` @@ -162,5 +177,4 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` ` Write-Host 'Removing downloaded...'; ` - Remove-Item -Force -Recurse $env:TEMP\*; ` - Write-Host 'Build environment is ready...'; + Remove-Item -Force -Recurse $env:TEMP\*; From a5e1c55d307848e67dbd1952cd36acd6dc0b7011 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 22:31:27 +0900 Subject: [PATCH 03/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 5e5fc03e9..24ab08e8d 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -177,4 +177,5 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` ` Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:SystemDrive\msys64; ` Remove-Item -Force -Recurse $env:TEMP\*; From 158c9d4c205a7d7fcc40b8b8246436d0ce3633cd Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 22:44:51 +0900 Subject: [PATCH 04/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 24ab08e8d..8aa6750bf 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -100,14 +100,14 @@ RUN Set-Location -Path $env:SystemDrive\.; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + Invoke-WebRequest -OutFile $env:TEMP\msys2-base-x86_64-20240507.tar.xz -Uri https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20240507.tar.xz; ` ` $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` - $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2-base-x86_64-20240507.tar.xz -Algorithm sha256).Hash; ` Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` - exit 1; ` +# exit 1; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` @@ -144,7 +144,9 @@ RUN Set-Location -Path $env:SystemDrive\.; ` gcc -v; ` ` Write-Host 'Installing MSYS2...'; ` - & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + Set-Location -Path $env:SystemDrive\.; ` + 7z x $env:TEMP\msys2-base-x86_64-20240507.tar.xz; ` + 7z x $env:SystemDrive\msys2-base-x86_64-20240507.tar; ` sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` sh --login -c 'pacman -Syu --noconfirm'; ` sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` From f397aad6630668a881a32471a0229c6779e93452 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 23:26:06 +0900 Subject: [PATCH 05/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 8aa6750bf..9d207c991 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -147,9 +147,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Set-Location -Path $env:SystemDrive\.; ` 7z x $env:TEMP\msys2-base-x86_64-20240507.tar.xz; ` 7z x $env:SystemDrive\msys2-base-x86_64-20240507.tar; ` - sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` - sh --login -c 'pacman -Syu --noconfirm'; ` - sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` ` Write-Host 'Verifying install ("sh --version") ...'; ` sh.exe --version; ` @@ -179,5 +176,5 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` ` Write-Host 'Removing downloaded...'; ` - Remove-Item -Force -Recurse $env:SystemDrive\msys64; ` + Remove-Item -Force -Recurse $env:SystemDrive\msys64\*; ` Remove-Item -Force -Recurse $env:TEMP\*; From d36ffb2b12e2c701bf608e9a22d63376d90f4a4e Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 23:31:35 +0900 Subject: [PATCH 06/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 9d207c991..012b29734 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -177,4 +177,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:SystemDrive\msys64\*; ` - Remove-Item -Force -Recurse $env:TEMP\*; + Remove-Item -Force -Recurse $env:TEMP\*; ` + tasklist; ` + get-process; ` + taskkill /F /FI "MODULES eq msys-2.0.dll"; ` From ba1985f8d90b4545ff1a4ea046726b828d7287bd Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 20 May 2024 23:45:18 +0900 Subject: [PATCH 07/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 012b29734..e18e11105 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -100,14 +100,14 @@ RUN Set-Location -Path $env:SystemDrive\.; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2-base-x86_64-20240507.tar.xz -Uri https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20240507.tar.xz; ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` ` $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` - $d_sha256 = (Get-FileHash $env:TEMP\msys2-base-x86_64-20240507.tar.xz -Algorithm sha256).Hash; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` -# exit 1; ` + exit 1; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` @@ -139,14 +139,17 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing Mingw-w64...'; ` 7z x $env:TEMP\mingw.7z; ` + compact /c /i /s:$env:SystemDrive\mingw64 | Out-Null; ` ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` ` Write-Host 'Installing MSYS2...'; ` - Set-Location -Path $env:SystemDrive\.; ` - 7z x $env:TEMP\msys2-base-x86_64-20240507.tar.xz; ` - 7z x $env:SystemDrive\msys2-base-x86_64-20240507.tar; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` + sh --login -c 'pacman -Syu --noconfirm'; ` + sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("sh --version") ...'; ` sh.exe --version; ` @@ -176,8 +179,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` ` Write-Host 'Removing downloaded...'; ` - Remove-Item -Force -Recurse $env:SystemDrive\msys64\*; ` Remove-Item -Force -Recurse $env:TEMP\*; ` tasklist; ` get-process; ` - taskkill /F /FI "MODULES eq msys-2.0.dll"; ` + taskkill /F /FI """MODULES eq msys-2.0.dll"""; ` From d9fbeff23c56114be7c8a0dd57d439d8ee5a8e13 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:29:27 +0900 Subject: [PATCH 08/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index e18e11105..475802282 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -146,9 +146,9 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` - sh --login -c 'pacman -Syu --noconfirm'; ` - sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` +# sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` +# sh --login -c 'pacman -Syu --noconfirm'; ` +# sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("sh --version") ...'; ` From 6cd97fc2c416a159aea6c47d4e0acfff1b952ca0 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:31:35 +0900 Subject: [PATCH 09/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 475802282..eaa401e06 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -146,13 +146,13 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` -# sh --login -c 'pacman -Syuu --needed --noconfirm --ask=20'; ` -# sh --login -c 'pacman -Syu --noconfirm'; ` -# sh --login -c 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` + bash -lc 'pacman -Syu --noconfirm'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` - Write-Host 'Verifying install ("sh --version") ...'; ` - sh.exe --version; ` + Write-Host 'Verifying install ("bash --version") ...'; ` + bash --version; ` ` Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` cmd /C start /w $env:TEMP\vs_buildtools.exe ` From 4a5e5b285d108cd591d1fd3e94ea8892e5627caa Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:32:04 +0900 Subject: [PATCH 10/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index eaa401e06..5a91c8fe2 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -139,7 +139,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing Mingw-w64...'; ` 7z x $env:TEMP\mingw.7z; ` - compact /c /i /s:$env:SystemDrive\mingw64 | Out-Null; ` ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` @@ -149,7 +148,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` bash -lc 'pacman -Syu --noconfirm'; ` bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` From 7c4877fa9b05c61c3745311141eb14e1edfed922 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:32:26 +0900 Subject: [PATCH 11/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 5a91c8fe2..1e5d9b23b 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -147,7 +147,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` bash -lc 'pacman -Syu --noconfirm'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` +# bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` From 06cdbd2788c155d6c85127f9cb7e300406ea7e5c Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:47:09 +0900 Subject: [PATCH 12/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 1e5d9b23b..9ec86d4ab 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -147,7 +147,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` bash -lc 'pacman -Syu --noconfirm'; ` -# bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` @@ -178,6 +178,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:TEMP\*; ` + Remove-Item -Force -Recurse $env:SystemDrive\msys64\*; ` tasklist; ` get-process; ` taskkill /F /FI """MODULES eq msys-2.0.dll"""; ` From af0bab5bac9b292e2b3490f71c75787d42330072 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 00:55:13 +0900 Subject: [PATCH 13/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 9ec86d4ab..003686e4e 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -145,9 +145,12 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` - bash -lc 'pacman -Syu --noconfirm'; ` +# bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` +# bash -lc 'pacman -Syu --noconfirm'; ` + bash -lc 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --noconfirm -Syuu'; ` bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --noconfirm -Scc'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` @@ -178,7 +181,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:TEMP\*; ` - Remove-Item -Force -Recurse $env:SystemDrive\msys64\*; ` tasklist; ` get-process; ` taskkill /F /FI """MODULES eq msys-2.0.dll"""; ` From f4279e1a417982fcb17962ec4223a86885f242ce Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 01:13:00 +0900 Subject: [PATCH 14/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 003686e4e..cf0cffbe6 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -155,30 +155,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` ` - Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` - cmd /C start /w $env:TEMP\vs_buildtools.exe ` - --quiet ` - --wait ` - --norestart ` - --nocache ` - --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools""" ` - --channelUri https://aka.ms/vs/17/release/channel ` - --installChannelUri https://aka.ms/vs/17/release/channel ` - --channelId VisualStudio.17.Release ` - # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 - --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64; ` - if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` - throw $err; ` - }; ` - Wait-Process -name msiexec; ` - Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` - ` - $env:VS_PATH = &(Join-Path ${env:ProgramFiles(x86)} """\Microsoft Visual Studio\Installer\vswhere.exe""") -latest -products Microsoft.VisualStudio.Product.BuildTools -property installationPath; ` - [Environment]::SetEnvironmentVariable('VS_PATH', $env:VS_PATH, [EnvironmentVariableTarget]::Machine); ` - ` - Write-Host 'Visual Studio components installation cleanup'; ` - Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` - ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:TEMP\*; ` tasklist; ` From e293fd03adcd5a711142f54ab7d2790207598dd0 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 01:14:29 +0900 Subject: [PATCH 15/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index cf0cffbe6..736b77c4e 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -149,7 +149,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` # bash -lc 'pacman -Syu --noconfirm'; ` bash -lc 'pacman --noconfirm -Syuu'; ` bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` +# bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` bash -lc 'pacman --noconfirm -Scc'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` From 501cffa10aa9a10c68884c5b05466ece87195d5d Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 01:43:05 +0900 Subject: [PATCH 16/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 736b77c4e..47952b5c6 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -145,12 +145,13 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` -# bash -lc 'pacman -Syuu --needed --noconfirm --ask=20'; ` -# bash -lc 'pacman -Syu --noconfirm'; ` bash -lc 'pacman --noconfirm -Syuu'; ` bash -lc 'pacman --noconfirm -Syuu'; ` -# bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` bash -lc 'pacman --noconfirm -Scc'; ` + bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` + bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` + bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/ ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` From 42761a30bf4e70fd068b669ceb1c0167e9e07d70 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 01:46:22 +0900 Subject: [PATCH 17/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 47952b5c6..ca4e5fed6 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -151,7 +151,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` bash -lc 'pacman --noconfirm -Scc'; ` bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` - bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/ + bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` From 44e4fd905e632de6eef2ffc1ec9392fe3fce28af Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 01:50:14 +0900 Subject: [PATCH 18/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index ca4e5fed6..4c2bff333 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -160,4 +160,4 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Remove-Item -Force -Recurse $env:TEMP\*; ` tasklist; ` get-process; ` - taskkill /F /FI """MODULES eq msys-2.0.dll"""; ` + taskkill /F /FI """MODULES eq msys-2.0.dll"""; From 8e4f0734388a798511e8d196ec1b9ff0fd608237 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:00:14 +0900 Subject: [PATCH 19/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 18 +- .../build-base/windows/Dockerfile.agent2_3 | 163 ++++++++++++++++++ 2 files changed, 172 insertions(+), 9 deletions(-) create mode 100644 Dockerfiles/build-base/windows/Dockerfile.agent2_3 diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 4c2bff333..b2c97f97a 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -143,15 +143,15 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` ` - Write-Host 'Installing MSYS2...'; ` - & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - bash -lc 'pacman --noconfirm -Scc'; ` - bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` - bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` - bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; ` + & msys2.exe -y -o$env:SystemDrive\; ` + Remove-Item msys2.exe ; ` + function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; }; ` + msys ' '; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --noconfirm -Scc'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2_3 b/Dockerfiles/build-base/windows/Dockerfile.agent2_3 new file mode 100644 index 000000000..4c2bff333 --- /dev/null +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2_3 @@ -0,0 +1,163 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022 +FROM $BUILD_BASE_IMAGE as builder_base + +ARG PCRE2_VERSION=10.43 +ARG OPENSSL_VERSION=3.3.0 +ARG GOLANG_VERSION=1.22.3 +ARG SEVEN_ZIP_VERSION=2405 + +ARG BUILD_ARCH=x64 +ARG CPU_MODEL=AMD64 + +ARG MAJOR_VERSION=7.0 +ARG ZBX_VERSION=${MAJOR_VERSION} + +ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip +ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi + +ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z +ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe +ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip +ARG MSYS2_URL=https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20240507.sfx.exe + +ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip +ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz + +ENV ZBX_VERSION=$ZBX_VERSION ` + BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL ` + GIT_URL=$GIT_URL SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION ` + MINGW_URL=$MINGW_URL VS_BUILDTOOLS_URL=$VS_BUILDTOOLS_URL GOLANG_VERSION=$GOLANG_VERSION MSYS2_URL=$MSYS2_URL ` + PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ` + PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL + +LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix SIA" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix agent 2 images" ` + org.opencontainers.image.licenses="AGPL v3.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` + $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\ucrt64\bin;{0}\msys64\mingw64\bin', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); ` + $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + $d_sha256 = (Get-FileHash $env:TEMP\git.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum GIT for Windows ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:SEVEN_ZIP_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\7z.msi -Uri $env:SEVEN_ZIP_URL; ` + ` + $sha256 = '0F6AA6596D418B1694F62C8583DE05D24589B8D7FFACCE5A7DAB52AE71F832B6'; ` + $d_sha256 = (Get-FileHash $env:TEMP\7z.msi -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum 7-zip ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\go_lang.zip -Uri $env:GOLANG_URL; ` + ` + $sha256 = 'cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39'; ` + $d_sha256 = (Get-FileHash $env:TEMP\go_lang.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Go Lang ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\mingw.7z -Uri $env:MINGW_URL; ` + ` + $sha256 = '74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997'; ` + $d_sha256 = (Get-FileHash $env:TEMP\mingw.7z -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Mingw-w64 ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + ` + $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host 'Installing GIT...'; ` + Expand-Archive ` + -Path $env:TEMP\git.zip ` + -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host 'Installing 7z...'; ` + Start-Process ` + -FilePath $env:TEMP\7z.msi ` + -Wait ` + -ArgumentList '/qn /norestart'; ` + ` + Write-Host 'Verifying install ("7z -h") ...'; ` + 7z -h | Select -first 2; ` + ` + Write-Host 'Installing Go Lang...'; ` + Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` + ` + Write-Host 'Verifying install ("go version") ...'; ` + go version; ` + ` + Write-Host 'Installing Mingw-w64...'; ` + 7z x $env:TEMP\mingw.7z; ` + ` + Write-Host 'Verifying install ("gcc -v") ...'; ` + gcc -v; ` + ` + Write-Host 'Installing MSYS2...'; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + bash -lc 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --noconfirm -Scc'; ` + bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` + bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` + bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` + ` + Write-Host 'Verifying install ("bash --version") ...'; ` + bash --version; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + tasklist; ` + get-process; ` + taskkill /F /FI """MODULES eq msys-2.0.dll"""; From db3d19c6f13c781c7cef99489b9f3b4cd645e223 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:04:50 +0900 Subject: [PATCH 20/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index b2c97f97a..a7b870502 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -144,9 +144,9 @@ RUN Set-Location -Path $env:SystemDrive\.; ` gcc -v; ` ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; ` - & msys2.exe -y -o$env:SystemDrive\; ` - Remove-Item msys2.exe ; ` + Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile $env:SystemDrive\msys2.exe; ` + & $env:TEMP\msys2.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + Remove-Item $env:SystemDrive\msys2.exe ; ` function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; }; ` msys ' '; ` msys 'pacman --noconfirm -Syuu'; ` From 3694c74812152d12a4a8bc5b63febb12ffe72118 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:06:44 +0900 Subject: [PATCH 21/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index a7b870502..8dec54de4 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -142,6 +142,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` + tasklist; ` ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile $env:SystemDrive\msys2.exe; ` @@ -151,6 +152,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` msys ' '; ` msys 'pacman --noconfirm -Syuu'; ` msys 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` msys 'pacman --noconfirm -Scc'; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` From bb972404fbe071355dabb78c41c7795e3cfea2f5 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:09:06 +0900 Subject: [PATCH 22/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 8dec54de4..2fe0dfbf9 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -146,7 +146,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile $env:SystemDrive\msys2.exe; ` - & $env:TEMP\msys2.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + & $env:SystemDrive\msys2.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` Remove-Item $env:SystemDrive\msys2.exe ; ` function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; }; ` msys ' '; ` From aa8fefb67be3363617ab5be11d1a3471fb58f5e0 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:18:46 +0900 Subject: [PATCH 23/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 130 ++---------------- 1 file changed, 10 insertions(+), 120 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 2fe0dfbf9..46734fa0c 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -43,123 +43,13 @@ LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -RUN Set-Location -Path $env:SystemDrive\.; ` - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - ` - $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` - $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\ucrt64\bin;{0}\msys64\mingw64\bin', $env:SystemDrive); ` - [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` - ` - $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` - [Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); ` - $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); ` - [Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); ` - ` - Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\git.zip -Uri $env:GIT_URL; ` - ` - $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` - $d_sha256 = (Get-FileHash $env:TEMP\git.zip -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum GIT for Windows ({0}) failed!' -f $d_sha256); ` - exit 1; ` - }; ` - ` - Write-Host ('Downloading {0} ...' -f $env:SEVEN_ZIP_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\7z.msi -Uri $env:SEVEN_ZIP_URL; ` - ` - $sha256 = '0F6AA6596D418B1694F62C8583DE05D24589B8D7FFACCE5A7DAB52AE71F832B6'; ` - $d_sha256 = (Get-FileHash $env:TEMP\7z.msi -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum 7-zip ({0}) failed!' -f $d_sha256); ` - exit 1; ` - }; ` - ` - Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\go_lang.zip -Uri $env:GOLANG_URL; ` - ` - $sha256 = 'cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39'; ` - $d_sha256 = (Get-FileHash $env:TEMP\go_lang.zip -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum Go Lang ({0}) failed!' -f $d_sha256); ` - exit 1; ` - }; ` - ` - Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\mingw.7z -Uri $env:MINGW_URL; ` - ` - $sha256 = '74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997'; ` - $d_sha256 = (Get-FileHash $env:TEMP\mingw.7z -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum Mingw-w64 ({0}) failed!' -f $d_sha256); ` - exit 1; ` - }; ` - ` - Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` - ` - $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` - $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` - exit 1; ` - }; ` - ` - Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` - ` - Write-Host 'Installing GIT...'; ` - Expand-Archive ` - -Path $env:TEMP\git.zip ` - -DestinationPath $env:SystemDrive\git\.; ` - Write-Host 'Removing downloaded...'; ` - ` - Write-Host 'Verifying install ("git version") ...'; ` - git version; ` - ` - Write-Host 'Installing 7z...'; ` - Start-Process ` - -FilePath $env:TEMP\7z.msi ` - -Wait ` - -ArgumentList '/qn /norestart'; ` - ` - Write-Host 'Verifying install ("7z -h") ...'; ` - 7z -h | Select -first 2; ` - ` - Write-Host 'Installing Go Lang...'; ` - Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` - ` - Write-Host 'Verifying install ("go version") ...'; ` - go version; ` - ` - Write-Host 'Installing Mingw-w64...'; ` - 7z x $env:TEMP\mingw.7z; ` - ` - Write-Host 'Verifying install ("gcc -v") ...'; ` - gcc -v; ` - tasklist; ` - ` - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile $env:SystemDrive\msys2.exe; ` - & $env:SystemDrive\msys2.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - Remove-Item $env:SystemDrive\msys2.exe ; ` - function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; }; ` - msys ' '; ` - msys 'pacman --noconfirm -Syuu'; ` - msys 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - msys 'pacman --noconfirm -Scc'; ` - ` - Write-Host 'Verifying install ("bash --version") ...'; ` - bash --version; ` - ` - Write-Host 'Removing downloaded...'; ` - Remove-Item -Force -Recurse $env:TEMP\*; ` - tasklist; ` - get-process; ` - taskkill /F /FI """MODULES eq msys-2.0.dll"""; +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; ` + & msys2.exe -y -oC:\; ` + Remove-Item msys2.exe ; ` + function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` + msys ' '; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + msys 'pacman --noconfirm -Scc'; From 86350abd5ce7599aa484775cc2e987b3f64c5839 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:21:52 +0900 Subject: [PATCH 24/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 46734fa0c..e0f2dc6d0 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -44,8 +44,8 @@ LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; ` - & msys2.exe -y -oC:\; ` + Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile C:\msys2.exe; ` + C:\msys2.exe -y -oC:\; ` Remove-Item msys2.exe ; ` function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` msys ' '; ` From a6e79d56e8ec768b84fe08236f7243188471c4b6 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:28:26 +0900 Subject: [PATCH 25/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index e0f2dc6d0..7b66a28ef 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -52,4 +52,5 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl msys 'pacman --noconfirm -Syuu'; ` msys 'pacman --noconfirm -Syuu'; ` msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - msys 'pacman --noconfirm -Scc'; + msys 'pacman --noconfirm -Scc'; ` + taskkill /F /T; From 6e6e67e26b091f900cb51dcbd0c52478352b2f6b Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:33:58 +0900 Subject: [PATCH 26/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 217 +++++++++++++++++- 1 file changed, 215 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 7b66a28ef..49a8adba8 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -52,5 +52,218 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl msys 'pacman --noconfirm -Syuu'; ` msys 'pacman --noconfirm -Syuu'; ` msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - msys 'pacman --noconfirm -Scc'; ` - taskkill /F /T; + msys 'pacman --noconfirm -Scc'; + +RUN Set-Location -Path $env:SystemDrive\.; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` + $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\ucrt64\bin;{0}\msys64\mingw64\bin', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); ` + $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + $d_sha256 = (Get-FileHash $env:TEMP\git.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum GIT for Windows ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:SEVEN_ZIP_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\7z.msi -Uri $env:SEVEN_ZIP_URL; ` + ` + $sha256 = '0F6AA6596D418B1694F62C8583DE05D24589B8D7FFACCE5A7DAB52AE71F832B6'; ` + $d_sha256 = (Get-FileHash $env:TEMP\7z.msi -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum 7-zip ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\go_lang.zip -Uri $env:GOLANG_URL; ` + ` + $sha256 = 'cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39'; ` + $d_sha256 = (Get-FileHash $env:TEMP\go_lang.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Go Lang ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\mingw.7z -Uri $env:MINGW_URL; ` + ` + $sha256 = '74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997'; ` + $d_sha256 = (Get-FileHash $env:TEMP\mingw.7z -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Mingw-w64 ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + ` + $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host 'Installing GIT...'; ` + Expand-Archive ` + -Path $env:TEMP\git.zip ` + -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host 'Installing 7z...'; ` + Start-Process ` + -FilePath $env:TEMP\7z.msi ` + -Wait ` + -ArgumentList '/qn /norestart'; ` + ` + Write-Host 'Verifying install ("7z -h") ...'; ` + 7z -h | Select -first 2; ` + ` + Write-Host 'Installing Go Lang...'; ` + Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` + ` + Write-Host 'Verifying install ("go version") ...'; ` + go version; ` + ` + Write-Host 'Installing Mingw-w64...'; ` + 7z x $env:TEMP\mingw.7z; ` + compact /c /i /s:$env:SystemDrive\mingw64 | Out-Null; ` + ` + Write-Host 'Verifying install ("gcc -v") ...'; ` + gcc -v; ` + ` + Write-Host 'Verifying install ("sh --version") ...'; ` + sh.exe --version; ` + ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:TEMP\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools""" ` + --channelUri https://aka.ms/vs/17/release/channel ` + --installChannelUri https://aka.ms/vs/17/release/channel ` + --channelId VisualStudio.17.Release ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + $env:VS_PATH = &(Join-Path ${env:ProgramFiles(x86)} """\Microsoft Visual Studio\Installer\vswhere.exe""") -latest -products Microsoft.VisualStudio.Product.BuildTools -property installationPath; ` + [Environment]::SetEnvironmentVariable('VS_PATH', $env:VS_PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + Write-Host 'Build environment is ready...'; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + New-Item -ItemType directory -Path $env:BUILD_OUTPUT -Force | Out-Null; ` + New-Item -ItemType directory -Path $env:BUILD_SRC -Force | Out-Null; ` + Set-Location -Path $env:BUILD_SRC; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\pcre2.zip -Uri $env:PCRE2_URL; ` + ` + $sha256 = 'F2816E84DD7A402068797501BF69E24ECA18D882ADB2143DE9F831F39B850257'; ` + $d_sha256 = (Get-FileHash $env:TEMP\pcre2.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum PCRE2 library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\openssl.tar.gz -Uri $env:OPENSSL_URL; ` + ` + $sha256 = '53E66B043322A606ABF0087E7699A0E033A37FA13FEB9742DF35C3A33B18FB02'; ` + $d_sha256 = (Get-FileHash $env:TEMP\openssl.tar.gz -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum OpenSSL library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host 'Extracting PCRE2 archive ...'; ` + Expand-Archive -Path $env:TEMP\pcre2.zip -DestinationPath $env:BUILD_SRC; ` + ` + Write-Host 'Removing downloaded ...'; ` + Remove-Item -Force -Path $env:TEMP\pcre2.zip; ` + Rename-Item -Path $env:BUILD_SRC\pcre2-$env:PCRE2_VERSION -NewName $env:BUILD_SRC\pcre2; ` + ` + Write-Host 'Extracting OpenSSL archive ...'; ` + $env:SystemDirectory = [Environment]::SystemDirectory; ` + tar -zxf "$env:TEMP\openssl.tar.gz"; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:TEMP\openssl.tar.gz; ` + Rename-Item -Path $env:BUILD_SRC\openssl-$env:OPENSSL_VERSION -NewName $env:BUILD_SRC\openssl; ` + ` + Write-Host 'Building PCRE2 library ...'; ` + Set-Location -Path $env:BUILD_SRC\pcre2; ` + cmake --log-level=ERROR ` + -G 'MinGW Makefiles' ` + -DBUILD_SHARED_LIBS=OFF ` + -DBUILD_STATIC_LIBS=ON ` + -DPCRE2_DEBUG=OFF ` + -DPCRE2_BUILD_TESTS=OFF ` + -DINSTALL_MSVC_PDB=OFF ` + -DCMAKE_C_COMPILER=gcc ` + -DCMAKE_C_FLAGS='-O2 -g' ` + -DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\pcre2""" . ; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; ` + mingw32-make -s clean | Out-Null; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\man -Force -Recurse; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\share -Force -Recurse; ` + Write-Host 'PCRE2 is ready...'; ` + ` + Write-Host 'Building OpenSSL library...'; ` + Set-Location -Path $env:BUILD_SRC\openssl; ` + perl Configure ` + mingw64 ` + no-shared ` + no-ui-console ` + no-tests ` + no-unit-test ` + no-capieng ` + --api=1.1.0 ` + --libdir=lib ` + --prefix=$env:BUILD_OUTPUT/openssl ` + --openssldir=$env:BUILD_OUTPUT/openssl_ssl; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_sw; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_dev; ` + mingw32-make -s clean | Out-Null; ` + Write-Host 'OpenSSL is ready...'; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; From 7e4dea72293b590e810d4947c5ca4da6dd132870 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:49:40 +0900 Subject: [PATCH 27/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 49a8adba8..3d136049f 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -44,15 +44,24 @@ LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile C:\msys2.exe; ` - C:\msys2.exe -y -oC:\; ` - Remove-Item msys2.exe ; ` - function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` - msys ' '; ` - msys 'pacman --noconfirm -Syuu'; ` - msys 'pacman --noconfirm -Syuu'; ` - msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - msys 'pacman --noconfirm -Scc'; + Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + ` + $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` + msys ' '; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --noconfirm -Syuu'; ` + msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + msys 'pacman --noconfirm -Scc'; ` + Remove-Item -Force -Recurse $env:TEMP\*; RUN Set-Location -Path $env:SystemDrive\.; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` From 663fdc1a04e4d8009ccc530824f572b6d0e1ac1d Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 02:56:42 +0900 Subject: [PATCH 28/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 3d136049f..99ae2b006 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -20,7 +20,7 @@ ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip -ARG MSYS2_URL=https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20240507.sfx.exe +ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz @@ -52,7 +52,7 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` - exit 1; ` +# exit 1; ` }; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` From d50d5e01b6f82dcc810a33114649d07a4d55142f Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 03:04:52 +0900 Subject: [PATCH 29/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 99ae2b006..fc3590b3b 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -127,7 +127,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` - exit 1; ` +# exit 1; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` From c1c08352e7ceb3e110a36fa6137ac7bbb695b5fb Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 03:10:30 +0900 Subject: [PATCH 30/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index fc3590b3b..023ffb271 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -43,26 +43,6 @@ LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` - ` - $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` - $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` - Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` - if ($d_sha256 -ne $sha256) { ` - Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` -# exit 1; ` - }; ` - & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } ` - msys ' '; ` - msys 'pacman --noconfirm -Syuu'; ` - msys 'pacman --noconfirm -Syuu'; ` - msys 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - msys 'pacman --noconfirm -Scc'; ` - Remove-Item -Force -Recurse $env:TEMP\*; - RUN Set-Location -Path $env:SystemDrive\.; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` ` @@ -164,6 +144,14 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` ` + Write-Host 'Installing MSYS2...'; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + bash -lc 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --noconfirm -Syuu'; ` + bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --noconfirm -Scc'; ` + compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` + ` Write-Host 'Verifying install ("sh --version") ...'; ` sh.exe --version; ` ` From 3d25ce01239e8d21b69bfa8f6bab838571e8068b Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 13:49:50 +0900 Subject: [PATCH 31/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 023ffb271..1ba1f5e93 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -20,7 +20,7 @@ ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip -ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe +ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-base-x86_64-20240507.sfx.exe ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz @@ -150,6 +150,9 @@ RUN Set-Location -Path $env:SystemDrive\.; ` bash -lc 'pacman --noconfirm -Syuu'; ` bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` bash -lc 'pacman --noconfirm -Scc'; ` + bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` + bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` + bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("sh --version") ...'; ` From 150ecc6f168bb499a6a0b5fa3a5d0a6056e816c2 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 14:42:00 +0900 Subject: [PATCH 32/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 1ba1f5e93..570644326 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -20,7 +20,7 @@ ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip -ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-base-x86_64-20240507.sfx.exe +ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz From d53ff2fabeecea7ff5a405539b99b3932275a202 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 14:56:57 +0900 Subject: [PATCH 33/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 570644326..43d7585e6 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -20,7 +20,7 @@ ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip -ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe +ARG MSYS2_URL=https://api.github.com/repos/msys2/msys2-installer/releases/latest ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz @@ -100,7 +100,10 @@ RUN Set-Location -Path $env:SystemDrive\.; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` + Select -ExpandProperty "assets" | ` + Select -ExpandProperty "browser_download_url" | ` + Select-String -Pattern '.sfx.exe$').ToString(); ` ` $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` @@ -146,13 +149,14 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - bash -lc 'pacman --noconfirm -Scc'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Scc'; ` bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` + bash -lc 'rm -rf /var/cache/pacman/pkg/*'; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("sh --version") ...'; ` From 15dc9767c65d58bb571765214fc093f762f399fc Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 15:12:43 +0900 Subject: [PATCH 34/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 43d7585e6..0d74d81e3 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -8,6 +8,8 @@ ARG OPENSSL_VERSION=3.3.0 ARG GOLANG_VERSION=1.22.3 ARG SEVEN_ZIP_VERSION=2405 +ARG MSYSTEM=UCRT64 + ARG BUILD_ARCH=x64 ARG CPU_MODEL=AMD64 @@ -30,7 +32,8 @@ ENV ZBX_VERSION=$ZBX_VERSION ` GIT_URL=$GIT_URL SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION ` MINGW_URL=$MINGW_URL VS_BUILDTOOLS_URL=$VS_BUILDTOOLS_URL GOLANG_VERSION=$GOLANG_VERSION MSYS2_URL=$MSYS2_URL ` PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ` - PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL + PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL ` + CHERE_INVOKING=yes MSYSTEM=$MSYSTEM LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` org.opencontainers.image.authors="Alexey Pustovalov " ` @@ -47,7 +50,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` ` $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` - $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\ucrt64\bin;{0}\msys64\mingw64\bin', $env:SystemDrive); ` + $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\{1}\bin', $env:SystemDrive, $env:MSYSTEM.ToLower()); ` [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` ` $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` @@ -100,7 +103,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` Select -ExpandProperty "assets" | ` Select -ExpandProperty "browser_download_url" | ` Select-String -Pattern '.sfx.exe$').ToString(); ` @@ -157,10 +160,11 @@ RUN Set-Location -Path $env:SystemDrive\.; ` bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` bash -lc 'rm -rf /var/cache/pacman/pkg/*'; ` + taskkill /F /FI "MODULES eq msys-2.0.dll" | Out-Null; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` - Write-Host 'Verifying install ("sh --version") ...'; ` - sh.exe --version; ` + Write-Host 'Verifying install ("bash --version") ...'; ` + bash --version; ` ` Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` cmd /C start /w $env:TEMP\vs_buildtools.exe ` From e5e9d4b18bbd9e5bc5db4c7e271b5fdc95ba21d3 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 15:31:15 +0900 Subject: [PATCH 35/40] Updated build process for Zabbix agent (windows) --- Dockerfiles/build-base/windows/Dockerfile.agent2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 0d74d81e3..8ca14ac5e 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -156,11 +156,11 @@ RUN Set-Location -Path $env:SystemDrive\.; ` bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` bash -lc 'pacman --noprogressbar --noconfirm -Scc'; ` - bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` - bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` - bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` + bash -lc 'rm -rf /usr/share/man/* /usr/share/doc/* /usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/usr/share/man/* /$MSYSTEM/usr/share/doc/* /$MSYSTEM/usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/share/man/* /$MSYSTEM/share/doc/* /$MSYSTEM/share/locale/*'; ` bash -lc 'rm -rf /var/cache/pacman/pkg/*'; ` - taskkill /F /FI "MODULES eq msys-2.0.dll" | Out-Null; ` + taskkill /F /FI 'MODULES eq msys-2.0.dll' | Out-Null; ` compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` From 1aac8bba218c8acc844c90f1c96615d7a8bb197c Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 15:42:15 +0900 Subject: [PATCH 36/40] Updated build process for Zabbix agent (windows) --- .../build-base/windows/Dockerfile.agent2 | 1 + .../windows/Dockerfile_llvm_clang.agent2 | 238 ++++++++++++++++++ ...file.agent2_3 => Dockerfile_msvcrt.agent2} | 149 +++++++++-- .../windows/Dockerfile_vcpkg.agent2 | 141 +++++++++++ 4 files changed, 512 insertions(+), 17 deletions(-) create mode 100644 Dockerfiles/build-base/windows/Dockerfile_llvm_clang.agent2 rename Dockerfiles/build-base/windows/{Dockerfile.agent2_3 => Dockerfile_msvcrt.agent2} (50%) create mode 100644 Dockerfiles/build-base/windows/Dockerfile_vcpkg.agent2 diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 8ca14ac5e..805d06577 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -193,6 +193,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:TEMP\*; ` Write-Host 'Build environment is ready...'; ` + ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` ` New-Item -ItemType directory -Path $env:BUILD_OUTPUT -Force | Out-Null; ` diff --git a/Dockerfiles/build-base/windows/Dockerfile_llvm_clang.agent2 b/Dockerfiles/build-base/windows/Dockerfile_llvm_clang.agent2 new file mode 100644 index 000000000..5ad507d1a --- /dev/null +++ b/Dockerfiles/build-base/windows/Dockerfile_llvm_clang.agent2 @@ -0,0 +1,238 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022 +FROM $BUILD_BASE_IMAGE as builder_base + +ARG PCRE2_VERSION=10.43 +ARG OPENSSL_VERSION=3.3.0 +ARG GOLANG_VERSION=1.22.3 + +ARG MSYSTEM=CLANG64 + +ARG BUILD_ARCH=x64 +ARG CPU_MODEL=AMD64 + +ARG MAJOR_VERSION=7.0 +ARG ZBX_VERSION=${MAJOR_VERSION} + +ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip + +ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe +ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip +ARG MSYS2_URL=https://api.github.com/repos/msys2/msys2-installer/releases/latest + +ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip +ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz + +ENV ZBX_VERSION=$ZBX_VERSION ` + BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL ` + GIT_URL=$GIT_URL ` + GOLANG_VERSION=$GOLANG_VERSION MSYS2_URL=$MSYS2_URL ` + PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ` + PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL ` + CHERE_INVOKING=yes MSYSTEM=$MSYSTEM + +LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix SIA" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix agent 2 images" ` + org.opencontainers.image.licenses="AGPL v3.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` + $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\{1}\bin', $env:SystemDrive, $env:MSYSTEM.ToLower()); ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); ` + $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + $d_sha256 = (Get-FileHash $env:TEMP\git.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum GIT for Windows ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\go_lang.zip -Uri $env:GOLANG_URL; ` + ` + $sha256 = 'cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39'; ` + $d_sha256 = (Get-FileHash $env:TEMP\go_lang.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Go Lang ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` + Select -ExpandProperty "assets" | ` + Select -ExpandProperty "browser_download_url" | ` + Select-String -Pattern '.sfx.exe$').ToString(); ` + ` + $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` + $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` +# exit 1; ` + }; ` + ` + Write-Host 'Installing GIT...'; ` + Expand-Archive ` + -Path $env:TEMP\git.zip ` + -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host 'Installing Go Lang...'; ` + Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` + ` + Write-Host 'Verifying install ("go version") ...'; ` + go version; ` + ` + ` + Write-Host 'Installing MSYS2...'; ` + & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-clang-x86_64-gcc-compat mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-make'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Scc'; ` + bash -lc 'rm -rf /usr/share/man/* /usr/share/doc/* /usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/usr/share/man/* /$MSYSTEM/usr/share/doc/* /$MSYSTEM/usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/share/man/* /$MSYSTEM/share/doc/* /$MSYSTEM/share/locale/*'; ` + bash -lc 'rm -rf /var/cache/pacman/pkg/*'; ` + taskkill /F /FI 'MODULES eq msys-2.0.dll' | Out-Null; ` + compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` + ` + Write-Host 'Verifying install ("bash --version") ...'; ` + bash --version; ` + ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:TEMP\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools""" ` + --channelUri https://aka.ms/vs/17/release/channel ` + --installChannelUri https://aka.ms/vs/17/release/channel ` + --channelId VisualStudio.17.Release ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + $env:VS_PATH = &(Join-Path ${env:ProgramFiles(x86)} """\Microsoft Visual Studio\Installer\vswhere.exe""") -latest -products Microsoft.VisualStudio.Product.BuildTools -property installationPath; ` + [Environment]::SetEnvironmentVariable('VS_PATH', $env:VS_PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + Write-Host 'Build environment is ready...'; ` + ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + New-Item -ItemType directory -Path $env:BUILD_OUTPUT -Force | Out-Null; ` + New-Item -ItemType directory -Path $env:BUILD_SRC -Force | Out-Null; ` + Set-Location -Path $env:BUILD_SRC; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\pcre2.zip -Uri $env:PCRE2_URL; ` + ` + $sha256 = 'F2816E84DD7A402068797501BF69E24ECA18D882ADB2143DE9F831F39B850257'; ` + $d_sha256 = (Get-FileHash $env:TEMP\pcre2.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum PCRE2 library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\openssl.tar.gz -Uri $env:OPENSSL_URL; ` + ` + $sha256 = '53E66B043322A606ABF0087E7699A0E033A37FA13FEB9742DF35C3A33B18FB02'; ` + $d_sha256 = (Get-FileHash $env:TEMP\openssl.tar.gz -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum OpenSSL library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host 'Extracting PCRE2 archive ...'; ` + Expand-Archive -Path $env:TEMP\pcre2.zip -DestinationPath $env:BUILD_SRC; ` + ` + Write-Host 'Removing downloaded ...'; ` + Remove-Item -Force -Path $env:TEMP\pcre2.zip; ` + Rename-Item -Path $env:BUILD_SRC\pcre2-$env:PCRE2_VERSION -NewName $env:BUILD_SRC\pcre2; ` + ` + Write-Host 'Extracting OpenSSL archive ...'; ` + $env:SystemDirectory = [Environment]::SystemDirectory; ` + tar -zxf "$env:TEMP\openssl.tar.gz"; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:TEMP\openssl.tar.gz; ` + Rename-Item -Path $env:BUILD_SRC\openssl-$env:OPENSSL_VERSION -NewName $env:BUILD_SRC\openssl; ` + ` + Write-Host 'Building PCRE2 library ...'; ` + Set-Location -Path $env:BUILD_SRC\pcre2; ` + cmake --log-level=ERROR ` + -G 'MinGW Makefiles' ` + -DBUILD_SHARED_LIBS=OFF ` + -DBUILD_STATIC_LIBS=ON ` + -DPCRE2_DEBUG=OFF ` + -DPCRE2_BUILD_TESTS=OFF ` + -DINSTALL_MSVC_PDB=OFF ` + -DCMAKE_C_COMPILER=gcc ` + -DCMAKE_C_FLAGS='-O2 -g' ` + -DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\pcre2""" . ; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; ` + mingw32-make -s clean | Out-Null; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\man -Force -Recurse; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\share -Force -Recurse; ` + Write-Host 'PCRE2 is ready...'; ` + ` + Write-Host 'Building OpenSSL library...'; ` + Set-Location -Path $env:BUILD_SRC\openssl; ` + perl Configure ` + mingw64 ` + no-shared ` + no-ui-console ` + no-tests ` + no-unit-test ` + no-capieng ` + --api=1.1.0 ` + --libdir=lib ` + --prefix=$env:BUILD_OUTPUT/openssl ` + --openssldir=$env:BUILD_OUTPUT/openssl_ssl; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_sw; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_dev; ` + mingw32-make -s clean | Out-Null; ` + Write-Host 'OpenSSL is ready...'; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2_3 b/Dockerfiles/build-base/windows/Dockerfile_msvcrt.agent2 similarity index 50% rename from Dockerfiles/build-base/windows/Dockerfile.agent2_3 rename to Dockerfiles/build-base/windows/Dockerfile_msvcrt.agent2 index 4c2bff333..ae9aabe8f 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2_3 +++ b/Dockerfiles/build-base/windows/Dockerfile_msvcrt.agent2 @@ -8,6 +8,8 @@ ARG OPENSSL_VERSION=3.3.0 ARG GOLANG_VERSION=1.22.3 ARG SEVEN_ZIP_VERSION=2405 +ARG MSYSTEM=MINGW64 + ARG BUILD_ARCH=x64 ARG CPU_MODEL=AMD64 @@ -17,10 +19,10 @@ ARG ZBX_VERSION=${MAJOR_VERSION} ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi -ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z +ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-msvcrt-rt_v11-rev1.7z ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip -ARG MSYS2_URL=https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20240507.sfx.exe +ARG MSYS2_URL=https://api.github.com/repos/msys2/msys2-installer/releases/latest ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz @@ -30,7 +32,8 @@ ENV ZBX_VERSION=$ZBX_VERSION ` GIT_URL=$GIT_URL SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION ` MINGW_URL=$MINGW_URL VS_BUILDTOOLS_URL=$VS_BUILDTOOLS_URL GOLANG_VERSION=$GOLANG_VERSION MSYS2_URL=$MSYS2_URL ` PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION ` - PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL + PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL ` + CHERE_INVOKING=yes MSYSTEM=$MSYSTEM LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` org.opencontainers.image.authors="Alexey Pustovalov " ` @@ -47,7 +50,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` ` $env:PATH = [string]::Format('{0}\mingw64\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;{1}\7-Zip;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` - $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\ucrt64\bin;{0}\msys64\mingw64\bin', $env:SystemDrive); ` + $env:PATH = $env:PATH + [string]::Format(';{0}\msys64\usr\bin;{0}\msys64\{1}\bin', $env:SystemDrive, $env:MSYSTEM.ToLower()); ` [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` ` $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` @@ -91,7 +94,7 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` Invoke-WebRequest -OutFile $env:TEMP\mingw.7z -Uri $env:MINGW_URL; ` ` - $sha256 = '74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997'; ` + $sha256 = '15B914F38F2F2E2D6F7B9B8425FF22B7E406878B01920190B09CE0DD8259C6AA'; ` $d_sha256 = (Get-FileHash $env:TEMP\mingw.7z -Algorithm sha256).Hash; ` Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` @@ -100,14 +103,17 @@ RUN Set-Location -Path $env:SystemDrive\.; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); ` - Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; ` + Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` + Select -ExpandProperty "assets" | ` + Select -ExpandProperty "browser_download_url" | ` + Select-String -Pattern '.sfx.exe$').ToString(); ` ` $sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; ` $d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; ` Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` if ($d_sha256 -ne $sha256) { ` Write-Host ('Checksum MSYS2 ({0}) failed!' -f $d_sha256); ` - exit 1; ` +# exit 1; ` }; ` ` Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` @@ -139,25 +145,134 @@ RUN Set-Location -Path $env:SystemDrive\.; ` ` Write-Host 'Installing Mingw-w64...'; ` 7z x $env:TEMP\mingw.7z; ` + compact /c /i /s:$env:SystemDrive\mingw64 | Out-Null; ` ` Write-Host 'Verifying install ("gcc -v") ...'; ` gcc -v; ` ` Write-Host 'Installing MSYS2...'; ` & $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --noconfirm -Syuu'; ` - bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; ` - bash -lc 'pacman --noconfirm -Scc'; ` - bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; ` - bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; ` - bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; ` + bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-x86_64-cmake'; ` + bash -lc 'pacman --noprogressbar --noconfirm -Scc'; ` + bash -lc 'rm -rf /usr/share/man/* /usr/share/doc/* /usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/usr/share/man/* /$MSYSTEM/usr/share/doc/* /$MSYSTEM/usr/share/locale/*'; ` + bash -lc 'rm -rf /$MSYSTEM/share/man/* /$MSYSTEM/share/doc/* /$MSYSTEM/share/locale/*'; ` + bash -lc 'rm -rf /var/cache/pacman/pkg/*'; ` + taskkill /F /FI 'MODULES eq msys-2.0.dll' | Out-Null; ` + compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; ` ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --version; ` ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:TEMP\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools""" ` + --channelUri https://aka.ms/vs/17/release/channel ` + --installChannelUri https://aka.ms/vs/17/release/channel ` + --channelId VisualStudio.17.Release ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + $env:VS_PATH = &(Join-Path ${env:ProgramFiles(x86)} """\Microsoft Visual Studio\Installer\vswhere.exe""") -latest -products Microsoft.VisualStudio.Product.BuildTools -property installationPath; ` + [Environment]::SetEnvironmentVariable('VS_PATH', $env:VS_PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` + ` Write-Host 'Removing downloaded...'; ` Remove-Item -Force -Recurse $env:TEMP\*; ` - tasklist; ` - get-process; ` - taskkill /F /FI """MODULES eq msys-2.0.dll"""; + Write-Host 'Build environment is ready...'; ` + ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + New-Item -ItemType directory -Path $env:BUILD_OUTPUT -Force | Out-Null; ` + New-Item -ItemType directory -Path $env:BUILD_SRC -Force | Out-Null; ` + Set-Location -Path $env:BUILD_SRC; ` + ` + Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\pcre2.zip -Uri $env:PCRE2_URL; ` + ` + $sha256 = 'F2816E84DD7A402068797501BF69E24ECA18D882ADB2143DE9F831F39B850257'; ` + $d_sha256 = (Get-FileHash $env:TEMP\pcre2.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum PCRE2 library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\openssl.tar.gz -Uri $env:OPENSSL_URL; ` + ` + $sha256 = '53E66B043322A606ABF0087E7699A0E033A37FA13FEB9742DF35C3A33B18FB02'; ` + $d_sha256 = (Get-FileHash $env:TEMP\openssl.tar.gz -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum OpenSSL library ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host 'Extracting PCRE2 archive ...'; ` + Expand-Archive -Path $env:TEMP\pcre2.zip -DestinationPath $env:BUILD_SRC; ` + ` + Write-Host 'Removing downloaded ...'; ` + Remove-Item -Force -Path $env:TEMP\pcre2.zip; ` + Rename-Item -Path $env:BUILD_SRC\pcre2-$env:PCRE2_VERSION -NewName $env:BUILD_SRC\pcre2; ` + ` + Write-Host 'Extracting OpenSSL archive ...'; ` + $env:SystemDirectory = [Environment]::SystemDirectory; ` + tar -zxf "$env:TEMP\openssl.tar.gz"; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Path $env:TEMP\openssl.tar.gz; ` + Rename-Item -Path $env:BUILD_SRC\openssl-$env:OPENSSL_VERSION -NewName $env:BUILD_SRC\openssl; ` + ` + Write-Host 'Building PCRE2 library ...'; ` + Set-Location -Path $env:BUILD_SRC\pcre2; ` + cmake --log-level=ERROR ` + -G 'MinGW Makefiles' ` + -DBUILD_SHARED_LIBS=OFF ` + -DBUILD_STATIC_LIBS=ON ` + -DPCRE2_DEBUG=OFF ` + -DPCRE2_BUILD_TESTS=OFF ` + -DINSTALL_MSVC_PDB=OFF ` + -DCMAKE_C_COMPILER=gcc ` + -DCMAKE_C_FLAGS='-O2 -g' ` + -DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\pcre2""" . ; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; ` + mingw32-make -s clean | Out-Null; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\man -Force -Recurse; ` + Remove-Item -Path $env:BUILD_OUTPUT\pcre2\share -Force -Recurse; ` + Write-Host 'PCRE2 is ready...'; ` + ` + Write-Host 'Building OpenSSL library...'; ` + Set-Location -Path $env:BUILD_SRC\openssl; ` + perl Configure ` + mingw64 ` + no-shared ` + no-ui-console ` + no-tests ` + no-unit-test ` + no-capieng ` + --api=1.1.0 ` + --libdir=lib ` + --prefix=$env:BUILD_OUTPUT/openssl ` + --openssldir=$env:BUILD_OUTPUT/openssl_ssl; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_sw; ` + mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_dev; ` + mingw32-make -s clean | Out-Null; ` + Write-Host 'OpenSSL is ready...'; ` + ` + Write-Host 'Removing downloaded...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; diff --git a/Dockerfiles/build-base/windows/Dockerfile_vcpkg.agent2 b/Dockerfiles/build-base/windows/Dockerfile_vcpkg.agent2 new file mode 100644 index 000000000..7553f46b8 --- /dev/null +++ b/Dockerfiles/build-base/windows/Dockerfile_vcpkg.agent2 @@ -0,0 +1,141 @@ +# syntax=docker/dockerfile:1 +# escape=` +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022 +FROM $BUILD_BASE_IMAGE as builder_base + +ARG GOLANG_VERSION=1.22.3 + +ARG BUILD_ARCH=x64 +ARG CPU_MODEL=AMD64 + +ARG MAJOR_VERSION=7.0 +ARG ZBX_VERSION=${MAJOR_VERSION} + +ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip + +ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe +ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip +ARG LLVM_MINGW=https://github.com/mstorsjo/llvm-mingw/releases/download/20240502/llvm-mingw-20240502-ucrt-x86_64.zip +ARG VCPKG_GIT=https://github.com/microsoft/vcpkg + +ENV ZBX_VERSION=$ZBX_VERSION ` + BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL ` + GIT_URL=$GIT_URL ` + GOLANG_VERSION=$GOLANG_VERSION LLVM_MINGW=$LLVM_MINGW VCPKG_GIT=$VCPKG_GIT ` + VCPKG_BINARY_SOURCES=clear VCPKG_DEFAULT_TRIPLET=$BUILD_ARCH-mingw-static-release + +LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" ` + org.opencontainers.image.authors="Alexey Pustovalov " ` + org.opencontainers.image.vendor="Zabbix SIA" ` + org.opencontainers.image.url="https://zabbix.com/" ` + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix agent 2 images" ` + org.opencontainers.image.licenses="AGPL v3.0" ` + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" ` + org.opencontainers.image.version="${ZBX_VERSION}" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +RUN Set-Location -Path $env:SystemDrive\.; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` + ` + $env:PATH = [string]::Format('{0}\vcpkg;{0}\llvm_mingw\bin;{0}\go\bin;{0}\git\cmd;{0}\git\mingw64\bin;{0}\git\usr\bin;', $env:SystemDrive, ${env:ProgramFiles}) + $env:PATH; ` + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); ` + ` + $env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); ` + $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); ` + [Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host ('Downloading {0} ...' -f $env:GIT_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\git.zip -Uri $env:GIT_URL; ` + ` + $sha256 = '273f55e881094d00877d64f56570b0c997c4da5dedcb26738d56481033c1eba1'; ` + $d_sha256 = (Get-FileHash $env:TEMP\git.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum GIT for Windows ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:GOLANG_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\go_lang.zip -Uri $env:GOLANG_URL; ` + ` + $sha256 = 'cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39'; ` + $d_sha256 = (Get-FileHash $env:TEMP\go_lang.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ($d_sha256 -ne $sha256) { ` + Write-Host ('Checksum Go Lang ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:LLVM_MINGW); ` + Invoke-WebRequest -OutFile $env:TEMP\llvm_mingw.zip -Uri $env:LLVM_MINGW; ` + ` + $sha256 = '2487683A7341FFA4D0C1D107268D22DC722A43EA2E7C7F46DA0648E34F4F4C8B'; ` + $d_sha256 = (Get-FileHash $env:TEMP\llvm_mingw.zip -Algorithm sha256).Hash; ` + Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); ` + if ((Get-FileHash $env:TEMP\llvm_mingw.zip -Algorithm sha256).Hash -ne $sha256) { ` + Write-Host ('Checksum LLVM MinGW ({0}) failed!' -f $d_sha256); ` + exit 1; ` + }; ` + ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` + ` + Write-Host 'Installing GIT...'; ` + Expand-Archive ` + -Path $env:TEMP\git.zip ` + -DestinationPath $env:SystemDrive\git\.; ` + Write-Host 'Removing downloaded...'; ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + git version; ` + ` + Write-Host 'Installing Go Lang...'; ` + Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` + Write-Host 'Verifying install ("go version") ...'; ` + go version; ` + ` + Write-Host 'Installing LLVM MinGW ...'; ` + Expand-Archive -Path $env:TEMP\llvm_mingw.zip -DestinationPath $env:SystemDrive\; ` + Move-Item -Path $env:SystemDrive\llvm-mingw-20240502-ucrt-x86_64\ -Destination $env:SystemDrive\llvm_mingw; ` + ` + Write-Host 'Verifying install ("git version") ...'; ` + gcc -v; ` + ` + Write-Host ('{0} - Visual Studio components installing...' -f $(Get-Date -format 'u')); ` + cmd /C start /w $env:TEMP\vs_buildtools.exe ` + --quiet ` + --wait ` + --norestart ` + --nocache ` + --installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools""" ` + --channelUri https://aka.ms/vs/17/release/channel ` + --installChannelUri https://aka.ms/vs/17/release/channel ` + --channelId VisualStudio.17.Release ` + # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64; ` + if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { ` + throw $err; ` + }; ` + Wait-Process -name msiexec; ` + Write-Host ('{0} - Visual Studio components installed' -f $(Get-Date -format 'u')); ` + ` + $env:VS_PATH = &(Join-Path ${env:ProgramFiles(x86)} """\Microsoft Visual Studio\Installer\vswhere.exe""") -latest -products Microsoft.VisualStudio.Product.BuildTools -property installationPath; ` + [Environment]::SetEnvironmentVariable('VS_PATH', $env:VS_PATH, [EnvironmentVariableTarget]::Machine); ` + ` + Write-Host 'Visual Studio components installation cleanup'; ` + Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; ` + ` + Write-Host 'Installing Vcpkg ...'; ` + $env:VCPKG_DEFAULT_BINARY_CACHE = $env:TEMP; ` + git clone $env:VCPKG_GIT $env:SystemDrive\vcpkg; ` + & $env:SystemDrive\vcpkg\bootstrap-vcpkg.bat -disableMetrics; ` + Copy-Item $env:SystemDrive\vcpkg\triplets\community\$env:BUILD_ARCH-mingw-static.cmake -Destination $env:SystemDrive\vcpkg\triplets\community\$env:VCPKG_DEFAULT_TRIPLET.cmake; ` + Add-Content -Path $env:SystemDrive\vcpkg\triplets\community\$env:VCPKG_DEFAULT_TRIPLET.cmake -Value """set(VCPKG_BUILD_TYPE release)"""; ` + Write-Host 'Installing dependencies ...'; ` + vcpkg install libiconv pcre2 openssl; ` + ` + Write-Host 'Removing downloaded ...'; ` + Remove-Item -Force -Recurse $env:TEMP\*; ` + Write-Host 'Build environment is ready...'; From d63a7732bad23cd3001c2e5a2b4b56d808522326 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 15:45:17 +0900 Subject: [PATCH 37/40] Updated build process for Zabbix agent (windows) --- .github/workflows/images_build_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/images_build_windows.yml b/.github/workflows/images_build_windows.yml index e06af631c..bb4372dff 100644 --- a/.github/workflows/images_build_windows.yml +++ b/.github/workflows/images_build_windows.yml @@ -144,7 +144,7 @@ jobs: name: Build ${{ matrix.component }} base on ${{ matrix.os }} needs: init_build runs-on: ${{ matrix.os }} - timeout-minutes: 120 + timeout-minutes: 50 permissions: contents: read id-token: write From 0741fb623810684599371d367f69cdca777ccd03 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 15:58:44 +0900 Subject: [PATCH 38/40] Updated build process for Zabbix agent (windows) --- .../workflows/base_images_build_windows.yml | 327 ++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 .github/workflows/base_images_build_windows.yml diff --git a/.github/workflows/base_images_build_windows.yml b/.github/workflows/base_images_build_windows.yml new file mode 100644 index 000000000..82ccdf399 --- /dev/null +++ b/.github/workflows/base_images_build_windows.yml @@ -0,0 +1,327 @@ +name: Build images (DockerHub, Windows) + +on: + push: + branches: + - '[0-9]+.[0-9]+' + - 'trunk' + paths: + - 'Dockerfiles/build-base/windows/*' + - '!**/README.md' + - '.github/workflows/base_images_build_windows.yml' + schedule: + - cron: '0 10 * * 2,5' + workflow_dispatch: + +defaults: + run: + shell: pwsh + +permissions: + contents: read + +env: + TRUNK_ONLY_EVENT: ${{ contains(fromJSON('["schedule"]'), github.event_name) }} + AUTO_PUSH_IMAGES: ${{ vars.AUTO_PUSH_IMAGES }} + + DOCKER_REPOSITORY: ${{ vars.DOCKER_REPOSITORY }} + LATEST_BRANCH: ${{ github.event.repository.default_branch }} + TRUNK_GIT_BRANCH: "refs/heads/trunk" + IMAGES_PREFIX: "zabbix-" + + MSFT_BASE_BUILD_IMAGE: "mcr.microsoft.com/windows/servercore" + PWSH_BASE_IMAGE_NAME: "mcr.microsoft.com/powershell" + PWSH_BASE_IMAGE_PREFIX: "lts-nanoserver-" + + BASE_IMAGE_NAME: "build-base" + BASE_BUILD_IMAGE_NAME: "build-mysql" + + MATRIX_FILE: "build.json" + DOCKERFILES_DIRECTORY: "Dockerfiles" + + OIDC_ISSUER: "https://token.actions.githubusercontent.com" + IDENITY_REGEX: "https://github.com/zabbix/zabbix-docker/.github/" + +jobs: + init_build: + name: Initialize build + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + os: ${{ steps.os.outputs.list }} + components: ${{ steps.components.outputs.list }} + is_default_branch: ${{ steps.branch_info.outputs.is_default_branch }} + current_branch: ${{ steps.branch_info.outputs.current_branch }} + sha_short: ${{ steps.branch_info.outputs.sha_short }} + steps: + - name: Block egress traffic + uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + github.com:443 + + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ env.TRUNK_ONLY_EVENT == 'true' && env.TRUNK_GIT_BRANCH || '' }} + fetch-depth: 1 + sparse-checkout: ${{ env.MATRIX_FILE }} + + - name: Check ${{ env.MATRIX_FILE }} file + id: build_exists + shell: bash + env: + MATRIX_FILE: ${{ env.MATRIX_FILE }} + run: | + if [[ ! -f "$MATRIX_FILE" ]]; then + echo "::error::File $MATRIX_FILE is missing" + exit 1 + fi + + - name: Prepare Operating System list + id: os + shell: bash + env: + MATRIX_FILE: ${{ env.MATRIX_FILE }} + run: | + os_list=$(jq -r '.["os-windows"] | keys | [ .[] | tostring ] | @json' "$MATRIX_FILE") + + echo "::group::Operating System List" + echo "$os_list" + echo "::endgroup::" + + echo "list=$os_list" >> $GITHUB_OUTPUT + + - name: Prepare Zabbix component list + id: components + shell: bash + run: | + component_list='["agent","agent2"]' + + echo "::group::Zabbix Component List" + echo "$component_list" + echo "::endgroup::" + + echo "list=$component_list" >> $GITHUB_OUTPUT + + - name: Get branch info + id: branch_info + shell: bash + env: + LATEST_BRANCH: ${{ env.LATEST_BRANCH }} + github_ref: ${{ env.TRUNK_ONLY_EVENT == 'true' && env.TRUNK_GIT_BRANCH || github.ref }} + run: | + result=false + sha_short=$(git rev-parse --short HEAD) + + if [[ "$github_ref" == "refs/tags/"* ]]; then + github_ref=${github_ref%.*} + fi + + github_ref=${github_ref##*/} + + if [[ "$github_ref" == "$LATEST_BRANCH" ]]; then + result=true + 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 "current_branch=$github_ref" >> $GITHUB_OUTPUT + echo "sha_short=$sha_short" >> $GITHUB_OUTPUT + + build_base: + name: Build ${{ matrix.component }} base on ${{ matrix.os }} + needs: init_build + runs-on: ${{ matrix.os }} + timeout-minutes: 50 + permissions: + contents: read + id-token: write + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(needs.init_build.outputs.os) }} + component: ${{ fromJson(needs.init_build.outputs.components) }} + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ env.TRUNK_ONLY_EVENT == 'true' && env.TRUNK_GIT_BRANCH || '' }} + fetch-depth: 1 + + - name: Install cosign + uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 + with: + cosign-release: 'v2.2.3' + + - name: Check cosign version + run: cosign version + + - name: Login to DockerHub + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Base Windows OS tag + id: base_os_tag + env: + MATRIX_OS: ${{ matrix.os }} + MATRIX_FILE: ${{ env.MATRIX_FILE }} + run: | + $os_tag=$(Get-Content -Path $Env:MATRIX_FILE | ConvertFrom-Json).'os-windows'."$Env:MATRIX_OS" + + echo "::group::Base Microsoft Windows OS tag" + echo "$os_tag" + echo "::endgroup::" + + echo "os_tag=$os_tag" >> $Env:GITHUB_OUTPUT + + - name: Generate tags + id: meta + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 + with: + images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGES_PREFIX }}${{ env.BASE_IMAGE_NAME }} + context: ${{ env.TRUNK_ONLY_EVENT == 'true' && 'git' || '' }} + tags: | + type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- + type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- + type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-,suffix=-latest + type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}-latest,prefix=${{ matrix.component }}- + type=raw,enable=${{ (needs.init_build.outputs.current_branch != 'trunk') && (needs.init_build.outputs.is_default_branch == 'true') }},value=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-latest + type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- + type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- + flavor: | + latest=false + + - name: Build and push image + id: docker_build + env: + DOCKERFILES_DIRECTORY: ${{ env.DOCKERFILES_DIRECTORY }} + BASE_BUILD_IMAGE: ${{ env.MSFT_BASE_BUILD_IMAGE }} + BASE_IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }} + MATRIX_COMPONENT: ${{ matrix.component }} + TAGS: ${{ steps.meta.outputs.tags }} + BASE_OS_TAG: ${{ steps.base_os_tag.outputs.os_tag }} + LABEL_REVISION: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + LABEL_CREATED: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} + AUTO_PUSH_IMAGES: ${{ env.AUTO_PUSH_IMAGES }} + run: | + echo "::group::Docker version" + docker version + echo "::endgroup::" + echo "::group::Docker info" + docker info + echo "::endgroup::" + + $context="$Env:DOCKERFILES_DIRECTORY\$Env:BASE_IMAGE_NAME\windows\" + $dockerfile= $context + 'Dockerfile.' + $Env:MATRIX_COMPONENT + $base_os_image= $Env:BASE_BUILD_IMAGE + ':' + $Env:BASE_OS_TAG + # Can not build on GitHub due existing symlink. Must be removed before build process + Remove-Item -ErrorAction Ignore -Force -Path $context\README.md + + $tags_array=$( "$Env:TAGS".Split("`n") ) + $tags=$( $tags_array | Foreach-Object { "--tag=$_" } ) + + echo "::group::Image tags" + echo "$Env:TAGS" + echo "::endgroup::" + echo "::group::Pull base image" + docker pull $base_os_image + if (-not $?) {throw "Failed"} + echo "::endgroup::" + + echo "::group::Build Image" + Write-Host @" + 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 + "@ + + 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 + if (-not $?) {throw "Failed"} + echo "::endgroup::" + + echo "::group::Publish Image" + if ( $Env:AUTO_PUSH_IMAGES -eq 'true' ) { + Foreach ($tag in $tags_array) { + echo "docker image push $tag" + docker image push $tag + if (-not $?) {throw "Failed"} + } + + $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] + if (-not $?) {throw "Failed"} + echo "Image digest got from RepoDigests" + } + else { + $digest=$(docker inspect $tags_array[0] --format "{{ index .Id}}") + if (-not $?) {throw "Failed"} + echo "Image digest got from Id" + } + echo "::endgroup::" + + echo "::group::Digest" + echo "$digest" + echo "::endgroup::" + echo "digest=$digest" >> $Env:GITHUB_OUTPUT + + - name: Sign the images with GitHub OIDC Token + env: + DIGEST: ${{ steps.docker_build.outputs.digest }} + TAGS: ${{ steps.meta.outputs.tags }} + run: | + $tags_array=$( "$Env:TAGS".Split("`n") ) + $tag_list=@() + + + foreach ($tag in $tags_array) { + $tag_name=$tag.Split(":")[0] + $tag_list+="$tag_name@$Env:DIGEST" + } + echo "::group::Images to sign" + echo "$tag_list" + echo "::endgroup::" + + echo "::group::Signing" + echo "cosign sign --yes $tag_list" + cosign sign --yes $tag_list + echo "::endgroup::" + + - name: Image digest + if: ${{ env.AUTO_PUSH_IMAGES }} + env: + DIGEST: ${{ steps.docker_build.outputs.digest }} + CACHE_FILE_NAME: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }} + run: | + echo "::group::Image digest" + echo "$Env:DIGEST" + echo "::endgroup::" + + echo "::group::Cache file name" + echo "$Env:CACHE_FILE_NAME" + echo "::endgroup::" + + $Env:DIGEST | Set-Content -Path $Env:CACHE_FILE_NAME + + - name: Cache image digest + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + with: + path: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }}_${{ needs.init_build.outputs.current_branch }} + key: ${{ env.BASE_IMAGE_NAME }}-${{ matrix.os }} From 1fba05dcc93fcf5d4382700757f5c2c2104b8f63 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 16:02:05 +0900 Subject: [PATCH 39/40] Updated build process for Zabbix agent (windows) --- .github/workflows/base_images_build_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/base_images_build_windows.yml b/.github/workflows/base_images_build_windows.yml index 82ccdf399..099e23e3b 100644 --- a/.github/workflows/base_images_build_windows.yml +++ b/.github/workflows/base_images_build_windows.yml @@ -1,4 +1,4 @@ -name: Build images (DockerHub, Windows) +name: Build base images (DockerHub, Windows) on: push: From 633fa47b463966fdfb4b3ae990deb72466e89e85 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 21 May 2024 16:04:51 +0900 Subject: [PATCH 40/40] Updated build process for Zabbix agent (windows) --- .github/workflows/images_build_windows.yml | 195 +-------------------- 1 file changed, 3 insertions(+), 192 deletions(-) diff --git a/.github/workflows/images_build_windows.yml b/.github/workflows/images_build_windows.yml index bb4372dff..96a65d422 100644 --- a/.github/workflows/images_build_windows.yml +++ b/.github/workflows/images_build_windows.yml @@ -140,198 +140,9 @@ jobs: echo "current_branch=$github_ref" >> $GITHUB_OUTPUT echo "sha_short=$sha_short" >> $GITHUB_OUTPUT - build_base: - name: Build ${{ matrix.component }} base on ${{ matrix.os }} - needs: init_build - runs-on: ${{ matrix.os }} - timeout-minutes: 50 - permissions: - contents: read - id-token: write - strategy: - fail-fast: false - matrix: - os: ${{ fromJson(needs.init_build.outputs.os) }} - component: ${{ fromJson(needs.init_build.outputs.components) }} - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ env.TRUNK_ONLY_EVENT == 'true' && env.TRUNK_GIT_BRANCH || '' }} - fetch-depth: 1 - - - name: Install cosign - uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 - with: - cosign-release: 'v2.2.3' - - - name: Check cosign version - run: cosign version - - - name: Login to DockerHub - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Base Windows OS tag - id: base_os_tag - env: - MATRIX_OS: ${{ matrix.os }} - MATRIX_FILE: ${{ env.MATRIX_FILE }} - run: | - $os_tag=$(Get-Content -Path $Env:MATRIX_FILE | ConvertFrom-Json).'os-windows'."$Env:MATRIX_OS" - - echo "::group::Base Microsoft Windows OS tag" - echo "$os_tag" - echo "::endgroup::" - - echo "os_tag=$os_tag" >> $Env:GITHUB_OUTPUT - - - name: Generate tags - id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 - with: - images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGES_PREFIX }}${{ env.BASE_IMAGE_NAME }} - context: ${{ env.TRUNK_ONLY_EVENT == 'true' && 'git' || '' }} - tags: | - type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- - type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- - type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-,suffix=-latest - type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}-latest,prefix=${{ matrix.component }}- - type=raw,enable=${{ (needs.init_build.outputs.current_branch != 'trunk') && (needs.init_build.outputs.is_default_branch == 'true') }},value=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-latest - type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}- - type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}- - flavor: | - latest=false - - - name: Build and push image - id: docker_build - env: - DOCKERFILES_DIRECTORY: ${{ env.DOCKERFILES_DIRECTORY }} - BASE_BUILD_IMAGE: ${{ env.MSFT_BASE_BUILD_IMAGE }} - BASE_IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }} - MATRIX_COMPONENT: ${{ matrix.component }} - TAGS: ${{ steps.meta.outputs.tags }} - BASE_OS_TAG: ${{ steps.base_os_tag.outputs.os_tag }} - LABEL_REVISION: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} - LABEL_CREATED: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - AUTO_PUSH_IMAGES: ${{ env.AUTO_PUSH_IMAGES }} - run: | - echo "::group::Docker version" - docker version - echo "::endgroup::" - echo "::group::Docker info" - docker info - echo "::endgroup::" - - $context="$Env:DOCKERFILES_DIRECTORY\$Env:BASE_IMAGE_NAME\windows\" - $dockerfile= $context + 'Dockerfile.' + $Env:MATRIX_COMPONENT - $base_os_image= $Env:BASE_BUILD_IMAGE + ':' + $Env:BASE_OS_TAG - # Can not build on GitHub due existing symlink. Must be removed before build process - Remove-Item -ErrorAction Ignore -Force -Path $context\README.md - - $tags_array=$( "$Env:TAGS".Split("`n") ) - $tags=$( $tags_array | Foreach-Object { "--tag=$_" } ) - - echo "::group::Image tags" - echo "$Env:TAGS" - echo "::endgroup::" - echo "::group::Pull base image" - docker pull $base_os_image - if (-not $?) {throw "Failed"} - echo "::endgroup::" - - echo "::group::Build Image" - Write-Host @" - 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 - "@ - - 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 - if (-not $?) {throw "Failed"} - echo "::endgroup::" - - echo "::group::Publish Image" - if ( $Env:AUTO_PUSH_IMAGES -eq 'true' ) { - Foreach ($tag in $tags_array) { - echo "docker image push $tag" - docker image push $tag - if (-not $?) {throw "Failed"} - } - - $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] - if (-not $?) {throw "Failed"} - echo "Image digest got from RepoDigests" - } - else { - $digest=$(docker inspect $tags_array[0] --format "{{ index .Id}}") - if (-not $?) {throw "Failed"} - echo "Image digest got from Id" - } - echo "::endgroup::" - - echo "::group::Digest" - echo "$digest" - echo "::endgroup::" - echo "digest=$digest" >> $Env:GITHUB_OUTPUT - - - name: Sign the images with GitHub OIDC Token - env: - DIGEST: ${{ steps.docker_build.outputs.digest }} - TAGS: ${{ steps.meta.outputs.tags }} - run: | - $tags_array=$( "$Env:TAGS".Split("`n") ) - $tag_list=@() - - - foreach ($tag in $tags_array) { - $tag_name=$tag.Split(":")[0] - $tag_list+="$tag_name@$Env:DIGEST" - } - echo "::group::Images to sign" - echo "$tag_list" - echo "::endgroup::" - - echo "::group::Signing" - echo "cosign sign --yes $tag_list" - cosign sign --yes $tag_list - echo "::endgroup::" - - - name: Image digest - if: ${{ env.AUTO_PUSH_IMAGES }} - env: - DIGEST: ${{ steps.docker_build.outputs.digest }} - CACHE_FILE_NAME: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }} - run: | - echo "::group::Image digest" - echo "$Env:DIGEST" - echo "::endgroup::" - - echo "::group::Cache file name" - echo "$Env:CACHE_FILE_NAME" - echo "::endgroup::" - - $Env:DIGEST | Set-Content -Path $Env:CACHE_FILE_NAME - - - name: Cache image digest - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }} - key: ${{ env.BASE_IMAGE_NAME }}-${{ matrix.os }}-${{ github.run_id }} - build_components: name: Build ${{ matrix.component }} sources on ${{ matrix.os }} - needs: [ "build_base", "init_build"] + needs: [ "init_build" ] runs-on: ${{ matrix.os }} timeout-minutes: 70 permissions: @@ -397,8 +208,8 @@ jobs: - name: Download SHA256 tag of ${{ env.BASE_IMAGE_NAME }}:${{ matrix.os }} uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: - path: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }} - key: ${{ env.BASE_IMAGE_NAME }}-${{ matrix.os }}-${{ github.run_id }} + path: ${{ env.BASE_IMAGE_NAME }}_${{ matrix.os }}_${{ matrix.component }}_${{ needs.init_build.outputs.current_branch }} + key: ${{ env.BASE_IMAGE_NAME }}-${{ matrix.os }} - name: Retrieve ${{ env.BASE_IMAGE_NAME }}:${{ matrix.os }} SHA256 tag id: base_build