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

FR: Ability to connect directly via IPv6 #77

Closed samip5 closed 4 months ago

samip5 commented 4 months ago

What feature do you want to see added?

I would like to see the ability to connect via IPv6, as IPv4 addresses cost extra.

Upstream changes

No response

Are you interested in contributing this feature?

No response

rkosegi commented 4 months ago

Hi @samip5, thank you for raising this feature request.

Since I'm lacking native IPv6 coverage locally, I'm not sure I can help to implement this. PR is always welcome.

samip5 commented 4 months ago

Hi @samip5,

thank you for raising this feature request.

Since I'm lacking native IPv6 coverage locally, I'm not sure I can help to implement this.

PR is always welcome.

You could probably use a tunnel for it from eg Hurricane Electric (which is free of charge).

Could you share some light into how does the plugin decide if it can connect via v4?

rkosegi commented 4 months ago

Hi @samip5, I have some doubts, but you should be able to force plugin to use IPv6 by choosing connection method Connect using public IPv6 address only.

It takes IPv6 as-is from Hetzner API and use it to establish SSH connection.

Would you be able to test it out? If so, I can provide a HPI file

samip5 commented 4 months ago

@rkosegi I should be able to test it, so please provide the hpi file.

samip5 commented 4 months ago

It takes IPv6 as-is from Hetzner API and use it to establish SSH connection.

You shouldn't take it as is. It's in a prefix notation, and the instance is reacheable at ::1 of the /64 prefix.

Eg it's usually like ::/64 but the correct address would end in ::1

rkosegi commented 4 months ago

Hi, @samip5 see attached hetzner-cloud.zip with HPI inside

It's the same thing (but zipped) if you build it yourself using mvn clean install on branch feature/ipv6-support. To install HPI file, just follow instructions in README

Just realized that you can also grab it from Jenkins itself :slightly_smiling_face:
https://ci.jenkins.io/job/Plugins/job/hetzner-cloud-plugin/view/change-requests/job/PR-78/

samip5 commented 4 months ago

It's the same thing (but zipped) if you build it yourself using mvn clean install on branch feature/ipv6-support.

I did actually try, but maven was quite unhappy, so it did not manage to even try to build it. :)

rkosegi commented 4 months ago

It's the same thing (but zipped) if you build it yourself using mvn clean install on branch feature/ipv6-support.

I did actually try, but maven was quite unhappy, so it did not manage to even try to build it. :)

yeah, it needs some setup, at least settings.xml should have jenkins' plugin repos

samip5 commented 4 months ago

It just occurred to me that connecting alone is not enough, as the server needs to be provisioned without IPv4 at all.

samip5 commented 4 months ago

Hi, @samip5 see attached hetzner-cloud.zip with HPI inside

It's the same thing (but zipped) if you build it yourself using mvn clean install on branch feature/ipv6-support. To install HPI file, just follow instructions in README

Just realized that you can also grab it from Jenkins itself 🙂 https://ci.jenkins.io/job/Plugins/job/hetzner-cloud-plugin/view/change-requests/job/PR-78/

It does work: 2024-04-28 10:35:03.546+0000 [id=3068] INFO c.d.j.p.h.Helper$LogAdapter#info: Connected to hcloud-vxxyedwa1wyixnyi via 2a01:4f9:c012:cb4a::1

But I meant this as connecting via IPv6 aka no IPv4 should be provisioned.

rkosegi commented 4 months ago

I made some improvements, build is here

Now you can specify connection method that enables IPv6 only (under advanced template options) image.

samip5 commented 4 months ago

Thanks, works as intended even if one would say that building things via IPv6-only is currently troublesome (due to Github and PyPi being unreacheable without NAT64/DNS64) :)

samip5 commented 4 months ago

Could we also have Connect using private IPv4 address if available, otherwise using public IPv6 address?