Skip to content

Commit

Permalink
upgrade vcpkg (#1837)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-christophe81 authored Nov 6, 2024
1 parent 4066eb7 commit 266ee0c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/agent_robot_test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $agent_log_path = $current_dir + "\reports\centagent.log"
Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name log_file -Value $agent_log_path

#Start agent
Start-Process -FilePath build_windows\agent\Release\centagent.exe -RedirectStandardOutput reports\centagent_stdout.log -RedirectStandardError reports\centagent_stderr.log
$agent_process = Start-Process -PassThru -FilePath build_windows\agent\Release\centagent.exe -ArgumentList "--standalone" -RedirectStandardOutput reports\centagent_stdout.log -RedirectStandardError reports\centagent_stderr.log

Write-Host ($agent_process | Format-Table | Out-String)

Expand All @@ -73,7 +73,7 @@ Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name en
$agent_log_path = $current_dir + "\reports\encrypted_centagent.log"
Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name log_file -Value $agent_log_path

Start-Process -FilePath build_windows\agent\Release\centagent.exe -RedirectStandardOutput reports\encrypted_centagent_stdout.log -RedirectStandardError reports\encrypted_centagent_stderr.log
Start-Process -FilePath build_windows\agent\Release\centagent.exe -ArgumentList "--standalone" -RedirectStandardOutput reports\encrypted_centagent_stdout.log -RedirectStandardError reports\encrypted_centagent_stderr.log


Start-Sleep -Seconds 1
Expand All @@ -86,7 +86,7 @@ Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name re
$agent_log_path = $current_dir + "\reports\reverse_centagent.log"
Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name log_file -Value $agent_log_path

Start-Process -FilePath build_windows\agent\Release\centagent.exe -RedirectStandardOutput reports\reversed_centagent_stdout.log -RedirectStandardError reports\reversed_centagent_stderr.log
Start-Process -FilePath build_windows\agent\Release\centagent.exe -ArgumentList "--standalone" -RedirectStandardOutput reports\reversed_centagent_stdout.log -RedirectStandardError reports\reversed_centagent_stderr.log

Start-Sleep -Seconds 1

Expand All @@ -98,7 +98,7 @@ Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name en
$agent_log_path = $current_dir + "\reports\encrypted_reverse_centagent.log"
Set-ItemProperty -Path HKLM:\SOFTWARE\Centreon\CentreonMonitoringAgent -Name log_file -Value $agent_log_path

Start-Process -FilePath build_windows\agent\Release\centagent.exe -RedirectStandardOutput reports\encrypted_reversed_centagent_stdout.log -RedirectStandardError reports\encrypted_reversed_centagent_stderr.log
Start-Process -FilePath build_windows\agent\Release\centagent.exe -ArgumentList "--standalone" -RedirectStandardOutput reports\encrypted_reversed_centagent_stdout.log -RedirectStandardError reports\encrypted_reversed_centagent_stderr.log

wsl cd $wsl_path `&`& .github/scripts/wsl-collect-test-robot.sh broker-engine/cma.robot $my_host_name $my_ip $pwsh_path ${current_dir}.replace('\','/')

Expand Down
28 changes: 19 additions & 9 deletions .github/scripts/windows-agent-compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ Write-Host $env:VCPKG_BINARY_SOURCES

$current_dir = $pwd.ToString()

#install recent version of 7zip needed by some packages
Write-Host "install 7zip"

#download 7zip
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2408-x64.msi" -OutFile "7z2408-x64.msi"
#install 7zip
Start-Process 'msiexec.exe' -ArgumentList '/I "7z2408-x64.msi" /qn' -Wait

#get cache from s3
$files_to_hash = "vcpkg.json", "custom-triplets\x64-windows.cmake", "CMakeLists.txt", "CMakeListsWindows.txt"
$files_content = Get-Content -Path $files_to_hash -Raw
Expand All @@ -32,8 +40,9 @@ $writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write($files_content -join " ")
$writer.Flush()
$stringAsStream.Position = 0
$vcpkg_release = "2024.10.21"
$vcpkg_hash = Get-FileHash -InputStream $stringAsStream -Algorithm SHA256 | Select-Object Hash
$file_name = "windows-agent-vcpkg-dependencies-cache-" + $vcpkg_hash.Hash
$file_name = "windows-agent-vcpkg-dependencies-cache-" + $vcpkg_hash.Hash + "-" + $vcpkg_release
$file_name_extension = "${file_name}.7z"

#try to get compiled dependenciesfrom s3
Expand All @@ -46,7 +55,7 @@ if ( $? -ne $true ) {
Write-Host "#######################################################################################################################"

Write-Host "install vcpkg"
git clone --depth 1 -b 2024.07.12 https://github.com/microsoft/vcpkg.git
git clone --depth 1 -b $vcpkg_release https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
cd $current_dir
Expand All @@ -57,23 +66,24 @@ if ( $? -ne $true ) {
Write-Host "compile vcpkg dependencies"
vcpkg install --vcpkg-root $env:VCPKG_ROOT --x-install-root build_windows\vcpkg_installed --x-manifest-root . --overlay-triplets custom-triplets --triplet x64-windows

Write-Host "Compress binary archive"
7z a $file_name_extension build_windows\vcpkg_installed
Write-Host "Upload binary archive"
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension
Write-Host "create CMake files"
if ( $? -eq $true ) {
Write-Host "Compress binary archive"
7z a $file_name_extension build_windows\vcpkg_installed
Write-Host "Upload binary archive"
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension
}
}
else {
7z x $file_name_extension
Write-Host "Create cmake files from binary-cache downloaded without use vcpkg"
}


Write-Host "create CMake files"

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_TESTING=On -DWINDOWS=On -DBUILD_FROM_CACHE=On -S. -DVCPKG_CRT_LINKAGE=dynamic -DBUILD_SHARED_LIBS=OFF -Bbuild_windows


Write-Host "------------- build agent and installer ---------------"
Write-Host "------------- build agent only ---------------"

cmake --build build_windows --config Release

4 changes: 4 additions & 0 deletions common/process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ add_library(

target_precompile_headers(centreon_process REUSE_FROM centreon_common)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(centreon_process INTERFACE Boost::process)
endif()

set_property(TARGET centreon_process PROPERTY POSITION_INDEPENDENT_CODE ON)

0 comments on commit 266ee0c

Please sign in to comment.