Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Comment on lines +28 to +62
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you seeing cases where the docker daemon is not up and running? Or is it because you're trashing a bunch of stuff on disk that might cause problems with it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the build has been flaky failing on the docker system prune -a -f command as it couldn't connect to the Docker daemon.


# Free disk space by removing pre-installed software we don't need
- name: Free disk space
run: |
Expand Down
28 changes: 28 additions & 0 deletions buildbot-worker/BuildbotWorker/Run-BuildbotWorker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Comment on lines +77 to +95
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @iangrunert so during development of these images I added some extensibility under the assumption that maybe there's some weird environment specific stuff needed for the host. In this particular case the above only seemed to be needed on a Windows Server host. It wasn't needed when running a Win 10/11 host. So that was a script done over in https://github.com/WebKitForWindows/buildbot-scripts .

Longer explanation at https://github.com/WebKitForWindows/buildbot-scripts/tree/main?tab=readme-ov-file#worker-container-administration-scripts

So this portion I'd probably be a no on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't built an automation around this, so end up manually run the copy / expand and restart the container afterwards. If you feel strongly about it though - I'll remove this and write a script to work around it.

Is anyone else actually using Run-BuildbotWorker.ps1 other than the Windows bots? If we're maintaining extra abstraction for a hypothetical situation where someone runs a buildbot on Win 10 / 11 instead of Server, when this request shouldn't break them anyway - it feels a little silly to generate additional automation work for myself.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using https://github.com/WebKitForWindows/buildbot-scripts at all? The idea is that your docker run includes -v <path-to-scripts>:C:/Scripts and then anything specific to your environment can run.

Our infrastructure had a bunch of fun things to deal with like proxies that has us running a bunch more in that scripts directory.

The idea was also about iterating since its simple to change the contents in that scripts directory vs doing a docker build.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm using it on each host, but only for the Invoke-WebRequests script.


# 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"
Comment on lines +97 to +99
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like this should be in a docker file proper.


# Clear ccache on restart
Write-Host "Clearing ccache"
ccache.exe -C
Comment on lines +101 to +103
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this. I'd put it in the Scripts directory since any ccache clearing logic could go in there.


# Initialize the Visual Studio environment
Write-Host 'Initializing Visual Studio environment';
Initialize-VSEnvironment -Architecture 'amd64' -Path (Get-VSBuildTools2022VCVarsAllPath);
Expand Down
Loading