Improve support for docker machine
This adds a few improvements to docker machine support:
- increases the
UsedCountat a time that machine isusedinstead 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
IdleCountdue toIdleTime, - put a timestamp in a few places for docker-machine,
- set
UsedCountto 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).