jenkinsci / amazon-ecs-plugin

Amazon EC2 Container Service Plugin for Jenkins
https://plugins.jenkins.io/amazon-ecs
MIT License
192 stars 226 forks source link

Added ability to define number of executors on agents #264

Closed plumbuma closed 2 years ago

plumbuma commented 2 years ago

Removing hardcoded number of executors per agent and adding ability for users to define this via the cloud configuration settings page.

serpentblade commented 1 year ago

FYI, This change breaks existing configurations as numExecutors defaults to 0 when the configuration is loaded back in.

I found this error in my jenkins logs after having to hunt down why my agents were not starting up:

Timer task hudson.slaves.NodeProvisioner$NodeProvisionerInvoker@744196d4 failed
java.lang.IllegalArgumentException
    at hudson.slaves.NodeProvisioner$PlannedNode.<init>(NodeProvisioner.java:102)
    at com.cloudbees.jenkins.plugins.amazonecs.ECSCloud.provision(ECSCloud.java:283)
    at com.cloudbees.jenkins.plugins.amazonecs.ECSProvisioningStrategy.apply(ECSProvisioningStrategy.java:65)
    at hudson.slaves.NodeProvisioner.update(NodeProvisioner.java:325)

I'd recommend updating the usage to initialize private int numExecutors = 1; or assure the value is always positive when calling the NodeProvisioner constructor using Math.max(1, numExecutors)

I as able to fix this by going back into my cloud configurations, finding the new field for "Number of executors per agent" which is revealed under an Advanced section, and updating the value from 0 to 1.