From 3ddb69514ef2cb24bae6f08bab96073c068bbca5 Mon Sep 17 00:00:00 2001 From: Ian Grunert Date: Sat, 11 Apr 2026 10:23:10 -0400 Subject: [PATCH] Run-BuildbotWorker improvements Automating a couple of manual steps: * Making a HTTP request to aws.amazon.com to prevent cert errors * Move perl to perl-msys so strawberry perl is on PATH for build * Clear ccache on restart Also wait for Docker to start at the beginning of the github actions build to work around https://github.com/actions/runner-images/issues/13729 --- .github/workflows/docker-image.yml | 37 +++++++++++++++++++ .../BuildbotWorker/Run-BuildbotWorker.ps1 | 28 ++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 31b15d29..562e2e5d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -24,6 +24,43 @@ jobs: steps: - uses: actions/checkout@v4 + # Wait for Docker daemon to be ready + - name: Wait for Docker + run: | + Write-Host "Waiting for Docker to be ready..." + for ($i = 1; $i -le 60; $i++) { + $output = docker info 2>&1 + if ($LASTEXITCODE -eq 0) { + Write-Host "Docker is ready!" + break + } + if ($i -eq 1) { + Write-Host "Docker not ready. Checking for Docker services..." + $dockerServices = Get-Service | Where-Object { $_.Name -like '*docker*' -or $_.DisplayName -like '*docker*' } + if ($dockerServices) { + Write-Host "Available Docker services:" + $dockerServices | Format-Table Name, Status, DisplayName -AutoSize + $dockerServices | Where-Object { $_.Status -ne 'Running' } | ForEach-Object { + Write-Host "Starting service: $($_.Name)" + Start-Service $_.Name -ErrorAction SilentlyContinue + } + } else { + Write-Error "No Docker services found." + exit 1 + } + } + if ($i % 10 -eq 0) { + Write-Host "Attempt $i/60 - Still waiting... Error: $output" + } else { + Write-Host "Attempt $i/60" + } + if ($i -eq 60) { + Write-Error "Docker failed to start after 60 attempts" + exit 1 + } + Start-Sleep -Seconds 2 + } + # Free disk space by removing pre-installed software we don't need - name: Free disk space run: | diff --git a/buildbot-worker/BuildbotWorker/Run-BuildbotWorker.ps1 b/buildbot-worker/BuildbotWorker/Run-BuildbotWorker.ps1 index 770fa0a4..e42400fe 100644 --- a/buildbot-worker/BuildbotWorker/Run-BuildbotWorker.ps1 +++ b/buildbot-worker/BuildbotWorker/Run-BuildbotWorker.ps1 @@ -74,6 +74,34 @@ Make sure the amount of disk space is set in the storage-opts setting of the dae "storage-opts": [ "size={0}GB" ]' -f $minDiskSpace); } +# Make a request to aws.amazon.com to prevent certificate errors when interacting with S3 +Write-Host 'Make a HTTP request to aws.amazon.com to prevent S3 certificate errors'; +$commandletArgs = @{ + UseBasicParsing = $true; + Method = 'Head' +}; +$urls = @( + 'https://aws.amazon.com' +); + +if (Test-Path env:HTTPS_PROXY) { + $commandletArgs['Proxy'] = $env:HTTPS_PROXY; +} + +foreach ($url in $urls) { + $commandletArgs['Uri'] = $url; + Write-Host ('Requesting {0}' -f $url); + Invoke-WebRequest @commandletArgs; +} + +# Move the git bash msys perl out of the way, so strawberry perl is on the path +Write-Host "Rename git bash msys perl, so strawberry perl is picked up first on PATH" +bash -c "test -f /usr/bin/perl && mv /usr/bin/perl /usr/bin/perl-msys" + +# Clear ccache on restart +Write-Host "Clearing ccache" +ccache.exe -C + # Initialize the Visual Studio environment Write-Host 'Initializing Visual Studio environment'; Initialize-VSEnvironment -Architecture 'amd64' -Path (Get-VSBuildTools2022VCVarsAllPath);