jenkinsci / hetzner-cloud-plugin

Hetzner cloud integration for Jenkins
https://plugins.jenkins.io/hetzner-cloud/
Apache License 2.0
24 stars 8 forks source link

Add option to provide cloud-init user data #60

Closed artur-borys closed 1 year ago

artur-borys commented 1 year ago

What feature do you want to see added?

Hi, I've recently stumbled upon this plugin. Forgive me if I'm mistaken, but I don't see any option to specify cloud-init user data.

Would it be possible to add that functionality? It seems to be possible when I'm looking at Hetzner Cloud API (https://docs.hetzner.cloud/#servers-create-a-server - user_data parameter)

I think this would be a very nice addition, as it would eliminate the need of creating custom images with JRE installed in form of snapshots, which causes additional cost of storing those snapshots. Instead, user could provide cloud-init file in which one could specify that JRE should be installed during VM creation

Upstream changes

No response

rkosegi commented 1 year ago

Hi @artur-borys, thank you for report!

Indeed, user-data was originally considered, but decision was made to prefer pre-created images via packer. I personally don't like this idea because it prolongs time from point where user requested to run a job to the point where job starts . However it's legit feature and I don't see reason to not have it.

I will look into this soon.

artur-borys commented 1 year ago

@rkosegi Thanks for the response. Honestly, I've just tried creating rocky-8 VM using hcloud CLI with and without cloud-init - the time seems almost identical, the installation of java-11-openjdk seems to be pretty fast.

Heres the cloud-init I was testing it with, probably as simple as it can get:

#cloud-config

packages:
  - java-11-openjdk

Don't feel forced by me to implement this 😄 If I'm the only one needing this, then it's probably not worth it - I may try to do it on my own and I'll submit a PR if I'm successful at it.