Skip to content

Fix docker-machine executor check to reduce warning log spam for no runners able to process a job

What does this MR do?

When IdleCount is set to 1 for the docker-machine executor, warning logs are spammed explaining there are no available runners to pick up jobs. This happens because the one "idle" runner created is "acquired" while it polls Gitlab for avaiable jobs to run. While the polling request waits for 50 seconds, other runner threads (or whatever they are otherwise called) check for idle runners https://gitlab.com/gitlab-org/gitlab-runner/-/blob/main/executors/docker/machine/provider.go#L527. While the single "idle" runner is polling for jobs it's marked as "acquired" so the check for idle runners always returns 0, causing the warning message to be spammed in the runner logs. This merge request fixes the check for runners able to process a job from checking only idle runners to checking "available" runners as defined by a pre-built function for returning number of available runners.

Why was this MR needed?

Fixes issue #2251 (closed)

What's the best way to test this MR?

Great question 🤔 - I built and ran it on a VM to test my changes, aside from the automated tests.

What are the relevant issue numbers?

2251

Edited by Thomas Scully

Merge request reports