Gitlab-runner autoscale, multiple jobs per machine

I’ve got gitlab-runner working with docker-machine, creating EC2 instances and it’s all working great. What I’d like to be able to do is to run multiple jobs simultaneously on a machine. This would also be useful in the docker service (non-auto-scaling).

The reason this would be useful is the economics of AWS. A t2.small instance is $0.025/hr. On the spot market, you can get instances for 80% off. But I can’t get a t2.small there. I can get a c3.medium for $0.03/hr, and that has the capacity for many jobs. I would still want scaling behavior, but only when I had exhausted the number of allowable concurrent jobs per machine (set in the config.toml file). My preference would be to load up a machine with as many jobs as possible and only start a new machine when that one was saturated. No need to round robin jobs across all machines.

This would also be desirable because it would result in less churn in instances. Instances are purchased by the hour; it’s the same price whether you use 30 seconds or 59 minutes. I realize I can smooth this out some using the idletime setting, but that measure is on how long the instance has been idle, not how long it’s been running.

Is such a thing possible, either in docker or docker+machine executors? Or could it be?

Dave P.


I’m facing exactly the same issue at the moment.
Any update or pointer on how to do this would be nice.