jenkinsci/ec2-plugin — pull request #86 by ikikko (2014-04-20 10:37:17+00:00)
Title: Modify condition of provisioning

Sometimes unrelated wrong slave was launched, but I couldn't build on the slave. It happened when slave template's usage was EXCLUSIVE and in the build queue there was a job which wasn't assigned any labels. So I have modified conditions of provisioning when usage is EXCLUSIVE.

Here is a matrix of slave template and job's label. Input parameters are three, slave templates' mode, label and job's label. A column of 'result : before' is as-is and a column 'after' is to-be or I expect.
* https://docs.google.com/spreadsheet/ccc?key=0Ajq41fTDA49TdHJlOEFNZENscXhxeE9peEk3cDRrQlE&usp=sharing

There was no problem when slave template's mode was NORMAL. But there was a problem when mode was EXCLUSIVE and job's label was empty.

As https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson/plugins/ec2/EC2Cloud.java#L176-L178, slave was launched if job's label was empty. But if the launched slave was EXCLUSIVE, the slave was not used for the job because slave's label didn't match the job's empty label. This is why wasted wrong slaves were launched.

6bb3172 is a main fix. You can understand what I want to do maybe.