-
Bug
-
Resolution: Unresolved
-
Minor
-
java.runtime.name: OpenJDK Runtime Environment
java.runtime.version: 11.0.7+10-post-Ubuntu-2ubuntu218.04
ec2: 1.49.1
It appears these lines of code and the methods they call are miscalculating availableTotalSlaves when using multiple "Amazon EC2" cloud configurations with the ec2 plugin.
We have multiple "Amazon EC2" clouds configured with one AMI config each instead of using a single "Amazon EC2" configuration with multiple AMI configs. This is due to using Jenkins Configuration as Code and wanting to be able to put each AMI config in a separate YAML file (one per "customer").
When we use the global instance cap (instanceCapStr) on one of these configurations, it seems to apply to ALL ec2 instances launched by the Jenkins master, not just the instances launched by that specific "Amazon EC2" cloud. It doesn't seem to use "cloudName" in the filter.
We have worked around this temporarily by using the AMI-specific instanceCap.
As weird as it is, I'm pretty certain this is working as intended - it's not that the instance cap is counting instances from all of your configured EC2 clouds, it's literally counting all of the instances you have in EC2, period, even the ones that have nothing to do with Jenkins. Per the documentation: "For example, if this field is 3, Jenkins will only launch a new instance as long as total number of instances you run on EC2 (regardless of whether that is for Jenkins or for other purposes) doesn't exceed this number."
The "global" instanceCapStr is of pretty limited utility, frankly. It's basically just a safety net to prevent infinite instance creation if Jenkins creates instances, then loses track of them without terminating them and so creates new ones, etc.