From 80187dbff839478331ad9d01c361a3a9234f32fd Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Wed, 1 Jan 2025 01:06:39 +0900 Subject: [PATCH] Sync with 7.2 branch --- .github/workflows/images_build_windows.yml | 1 + Dockerfiles/agent2/alpine/Dockerfile | 1 + Dockerfiles/agent2/centos/Dockerfile | 1 + Dockerfiles/agent2/ol/Dockerfile | 1 + Dockerfiles/agent2/rhel/Dockerfile | 1 + Dockerfiles/agent2/ubuntu/Dockerfile | 1 + Dockerfiles/agent2/windows/Dockerfile | 1 + .../build-base/windows/Dockerfile.agent2 | 86 +++++-------------- 8 files changed, 27 insertions(+), 66 deletions(-) diff --git a/.github/workflows/images_build_windows.yml b/.github/workflows/images_build_windows.yml index 05a0a05467..03507fdaae 100644 --- a/.github/workflows/images_build_windows.yml +++ b/.github/workflows/images_build_windows.yml @@ -9,6 +9,7 @@ on: - '[0-9]+.[0-9]+' - 'trunk' paths: + - 'build.json' - 'Dockerfiles/*/windows/*' - '!**/README.md' - '.github/workflows/images_build_windows.yml' diff --git a/Dockerfiles/agent2/alpine/Dockerfile b/Dockerfiles/agent2/alpine/Dockerfile index 913f1d7576..cb78a73674 100644 --- a/Dockerfiles/agent2/alpine/Dockerfile +++ b/Dockerfiles/agent2/alpine/Dockerfile @@ -61,6 +61,7 @@ RUN set -eux && \ echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \ mkdir -p ${ZABBIX_CONF_DIR} && \ mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agentd.d && \ + mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \ mkdir -p ${ZABBIX_USER_HOME_DIR} && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \ diff --git a/Dockerfiles/agent2/centos/Dockerfile b/Dockerfiles/agent2/centos/Dockerfile index 0d4bfd0fdc..644f3200c5 100644 --- a/Dockerfiles/agent2/centos/Dockerfile +++ b/Dockerfiles/agent2/centos/Dockerfile @@ -82,6 +82,7 @@ RUN --mount=type=tmpfs,target=/var/lib/dnf/ \ echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \ mkdir -p ${ZABBIX_CONF_DIR} && \ mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agentd.d && \ + mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \ mkdir -p ${ZABBIX_USER_HOME_DIR} && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \ diff --git a/Dockerfiles/agent2/ol/Dockerfile b/Dockerfiles/agent2/ol/Dockerfile index 85e95673be..2de90da66b 100644 --- a/Dockerfiles/agent2/ol/Dockerfile +++ b/Dockerfiles/agent2/ol/Dockerfile @@ -70,6 +70,7 @@ RUN --mount=type=tmpfs,target=/var/lib/dnf/ \ echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \ mkdir -p ${ZABBIX_CONF_DIR} && \ mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agentd.d && \ + mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \ mkdir -p ${ZABBIX_USER_HOME_DIR} && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \ diff --git a/Dockerfiles/agent2/rhel/Dockerfile b/Dockerfiles/agent2/rhel/Dockerfile index 1c8dd0b517..8255aaf55d 100644 --- a/Dockerfiles/agent2/rhel/Dockerfile +++ b/Dockerfiles/agent2/rhel/Dockerfile @@ -106,6 +106,7 @@ RUN --mount=type=tmpfs,target=/var/lib/dnf/ \ echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \ mkdir -p ${ZABBIX_CONF_DIR} && \ mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agentd.d && \ + mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \ mkdir -p ${ZABBIX_USER_HOME_DIR} && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \ diff --git a/Dockerfiles/agent2/ubuntu/Dockerfile b/Dockerfiles/agent2/ubuntu/Dockerfile index 1ef6f3ff04..19b62b2d24 100644 --- a/Dockerfiles/agent2/ubuntu/Dockerfile +++ b/Dockerfiles/agent2/ubuntu/Dockerfile @@ -65,6 +65,7 @@ RUN --mount=type=cache,target=/var/cache/apt/,sharing=locked \ echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \ mkdir -p ${ZABBIX_CONF_DIR} && \ mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agentd.d && \ + mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \ mkdir -p ${ZABBIX_USER_HOME_DIR} && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \ mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \ diff --git a/Dockerfiles/agent2/windows/Dockerfile b/Dockerfiles/agent2/windows/Dockerfile index 5cbba06d6d..8a41236cfb 100644 --- a/Dockerfiles/agent2/windows/Dockerfile +++ b/Dockerfiles/agent2/windows/Dockerfile @@ -45,6 +45,7 @@ RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemD RUN Set-Location -Path $env:SystemDrive\.; ` ` New-Item -Force -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; ` + New-Item -Force -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agent2.d | Out-Null; ` New-Item -Force -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; ` New-Item -Force -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; ` ` diff --git a/Dockerfiles/build-base/windows/Dockerfile.agent2 b/Dockerfiles/build-base/windows/Dockerfile.agent2 index 531a362541..08ccf2e83d 100644 --- a/Dockerfiles/build-base/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-base/windows/Dockerfile.agent2 @@ -6,7 +6,6 @@ FROM $BUILD_BASE_IMAGE AS builder_base ARG PCRE2_VERSION=10.43 ARG OPENSSL_VERSION=3.1.5 ARG GOLANG_VERSION=1.23.2 -ARG SEVEN_ZIP_VERSION=2405 ARG MSYSTEM=MINGW64 @@ -16,9 +15,6 @@ ARG CPU_MODEL=AMD64 ARG MAJOR_VERSION=6.0 ARG ZBX_VERSION=${MAJOR_VERSION}.37 -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/8.5.0-rt_v10-rev0/x86_64-8.5.0-release-win32-sjlj-rt_v10-rev0.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 @@ -29,7 +25,6 @@ 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 ` @@ -49,8 +44,7 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref 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()); ` + $env:PATH = $env:PATH + [string]::Format(';{0}\mingw64\bin;{0}\go\bin;{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); ` @@ -58,28 +52,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` $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; ` ` @@ -91,17 +63,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` exit 1; ` }; ` ` - Write-Host ('Downloading {0} ...' -f $env:MINGW_URL); ` - Invoke-WebRequest -UserAgent 'Wget' -Uri $env:MINGW_URL -OutFile $env:TEMP\mingw.7z; ` - ` - $sha256 = 'e8c65ddc655534b0330f66f7b480565621e8617cda9937d76ba141a22bf3b2fa'; ` - $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 $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | ` Select -ExpandProperty "assets" | ` @@ -116,26 +77,19 @@ RUN Set-Location -Path $env:SystemDrive\.; ` # 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 ('Downloading {0} ...' -f $env:MINGW_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\mingw.7z -Uri $env:MINGW_URL; ` ` - Write-Host 'Installing 7z...'; ` - Start-Process ` - -FilePath $env:TEMP\7z.msi ` - -Wait ` - -ArgumentList '/qn /norestart'; ` + $sha256 = 'e8c65ddc655534b0330f66f7b480565621e8617cda9937d76ba141a22bf3b2fa'; ` + $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 'Verifying install ("7z -h") ...'; ` - 7z -h | Select -first 2; ` + Write-Host ('Downloading {0} ...' -f $env:VS_BUILDTOOLS_URL); ` + Invoke-WebRequest -OutFile $env:TEMP\vs_buildtools.exe $env:VS_BUILDTOOLS_URL; ` ` Write-Host 'Installing Go Lang...'; ` Expand-Archive -Path $env:TEMP\go_lang.zip -DestinationPath $env:SystemDrive\; ` @@ -143,18 +97,11 @@ 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 '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-x86_64-cmake'; ` + bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-7zip git'; ` 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/*'; ` @@ -166,6 +113,13 @@ RUN Set-Location -Path $env:SystemDrive\.; ` Write-Host 'Verifying install ("bash --version") ...'; ` bash --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 `