Hi,
I am in the process of putting together a PR for Ec2 plugin to support launch templates. The advantage for me is that I can use an external tool such as terraform to manage my slave configurations. I have made quite decent progress in as much as I have the plugin able to launch with a template.
It is a bit of a paradigm shift because it means Jenkins doesn't know as much as it used to about a launched instance, i.e. AMI, type, etc.
However, I have come across two problems that are causing me to rethink the approach.
Firstly, reading the code, it seems that it filters for stopped instances that can be restarted based on known things like AMI, type etc. If I simply tag on the launch template at launch time, then Jenkins doesn't know these things. I thought I would be able to filter by launch template/version, but this doesn't seem to be possible. So I am thinking that I am better pulling what is needed from the launch template and populating the request with those values, i.e. the plugin handles things, rather than the AWS launch template subsystem. This feels wrong, but I can't see a simpler solution.
The second problem is somewhat similar. I was looking how to implement this for spot requests and it seems that the API doesn't allow you to specify a launch template (unless I missed it!). You can launch it in the gui, but I am guessing that the gui does the pulling of the data rather than the API. So, I think I am going to have to implement something like the above for spot, anyway,
This is my first attempt at anything like this, so I might have misunderstood some conventions, so please feel free to comment on anything that is seen as amiss.
https://github.com/dlcc/ec2-plugin/pull/1/filesI also intend to throw in `unlimited` t2 option as well, while I am on.
Thanks for reading,
Ian