Status: Resolved (View Workflow)
A combination of factors:
- Our builds are fairly infrequent
- Our instance set up + build is a bit less than an hour (but instance set up + build + wait 30 minutes is more than an hour)
- It would be nice not have to trust the code we are building too much
mean that for our purposes we would like to start a fresh instance for each build we do.
I've had a bit of a look at this, and it seems that one approach would be to play with the RetentionStrategy used for the ec2 slaves, but I'm not sure that this would result in the slave being terminated if there was a build waiting when one finished.
$500 for whoever fixes this
So... I know this is a long standing issue at this point but I've developed a work around to get single use instances with a bit of hackery.
The Single Use Slave Plugin along with this remove_ec2_node.groovy script run from a cron job against the Jenkins node will get you an effective working solution.
Having something like this is pretty important to my customers, especially now that EC2 bills by the second instead of by the hour!
I actually would like this as well, but I havnt been able to figure out how to do it. Right now I have Jenkins creating an instance with a single executor and I start Job1 which is taged to run on that new node. I then start Job2 which is taged to start on the same slave but it seems to wait for that executor on the first slave to finish. How can I make it scale up another slave for Job2?