jenkinsci / ec2-fleet-plugin

The EC2 Fleet plugin launches EC2 instances as worker nodes for Jenkins CI server, automatically scaling the capacity with the load.
https://plugins.jenkins.io/ec2-fleet/
Apache License 2.0
111 stars 81 forks source link

Add backwards compatibility for executor scaling feature #424

Closed GavinBurris42 closed 12 months ago

GavinBurris42 commented 1 year ago

The new executor scaling feature involved the introduction the new executorScaler field for EC2FleetCloud, and the removal of the scaleExecutorsByWeight field. Upon upgrading from from an old version to a new version, including this change, the EC2FleetCloud unmarshalled from the users Jenkins config.xml file would set the executorScaler field to null, causing a NullPointer error during Agent provisioning.

The Jenkins clouds are being updated to include the new field during its periodic update. The executorScaler is based on the old scaleExecutorsByWeight field, which is now solely used for the instantiation of the executorScaler field. If a user previously configured executors to be scaled by weights it will continue to do so. These changes are then saved to the user's Jenkins config.xml file.

Testing done

Updated unit tests for the changed made for the backwards compatibility. Performed manual testing regarding upgrading from version 3.0.1 and 3.0.2. Validated that the config.xml file pertains its configurations and is updated with the new executorScaler field.