Improve support for docker machine
This adds a few improvements to docker machine support:
- increases the
UsedCount
at a time that machine isused
instead of doing that when releasing, - remove machine when releasing if it UsedCount is over MaxBuilds,
- look for free machines in reverse order, this is to increase a change of using the newest created machine and increasing the probability of removing over idle ones - previously we were using machines from the oldest created, thus always going over
IdleCount
due toIdleTime
, - put a timestamp in a few places for docker-machine,
- set
UsedCount
to 1 to mark a machines as dirty on start, otherwise if you restart runner, the runner will run build on already dirty machines (especially important if you have MaxBuilds = 1).