jenkins-control-plugin icon indicating copy to clipboard operation
jenkins-control-plugin copied to clipboard

Feature Request: Handle different Jenkins URLs if work with VPN e.g

Open Andrerm124 opened this issue 4 years ago • 10 comments

First of all, from what I can tell this seems like a brilliant plugin so well done for that. Secondly, I'm unsure whether this is actually a problem of the plugin so I hold no faults against it just yet.

I've set up the plugin as expected with the correct server url (Ending in :8080), I've added an auth token as CSRF requires it, and I've also added the crumb data just to see if that helps anything. However, whenever the plugin tries to Authenticate Jenkins I get a message saying that there has been a port mismatch and that the actual is -1.

It's worth noting that in order to connect to jenkins I have to use a VPN and I do not have admin access to it.

I'd really appreciate any help, thanks a bunch 🙂

Andrerm124 avatar Feb 26 '20 07:02 Andrerm124

Nevermind, as I expected it was nothing to do with the plugin... Ran through the code of this plugin and found that the views that are being returned by Jenkins have the wrong url. Again, nothing to do with the plugin, however it was easier for me to fork the plugin and add some code to the JenkinsJsonParser to replace any instance of the wrong url with the correct url.

Plugin seems to be working perfectly now, thanks a bunch :)

Andrerm124 avatar Feb 26 '20 08:02 Andrerm124

Nice to hear. But why the jenkins deliver wrong urls?

And what do you think about a PR for this?

MCMicS avatar Feb 26 '20 10:02 MCMicS

It was purely down to how my company deals with its network infrastructure... We use a VPN to connect in to our jenkins pipeline and use a custom domain name for the connection, however the jenkins server itself believes it has the original domain name (Not the one the VPN routes through).

My solution was purely a hack to hardcode replace the non-vpn url to the vpn url. I highly doubt many people would have this issue and if they did a fix for it would be fairly hacky.

If it turns out to actually be a common problem then the solution is to simply do a find/replace on the "parseJson" function to force the Server Address the user entered

Andrerm124 avatar Feb 26 '20 11:02 Andrerm124

And what about an option to add an optional second url in settings?

One which is seen by plugin and one the the original. So it is configurable which replacement will be done

MCMicS avatar Feb 26 '20 12:02 MCMicS

That was my thinking as well, it'd certainly be possible but I'm not sure how much it'd be required as I imagine it'd be really uncommon of an issue

Andrerm124 avatar Feb 26 '20 12:02 Andrerm124

I can create an feature request for it. I think a scenario behind a VPN or some other kind of wall is possible

MCMicS avatar Feb 26 '20 18:02 MCMicS

I'd find this enhancement useful. A Jenkins server I connect to has a different URL externally, so setting up the plugin fails for me with the message: Jenkins Server Host Mismatch: expected='jenkins-external-hostname' - actual='jenkins-internal-hostname'. Look at the value of 'Jenkins URL' at http://jenkins-external-hostname/jenkins/configure

e2m4n avatar Oct 28 '21 15:10 e2m4n

I try to add this asap

MCMicS avatar Oct 28 '21 15:10 MCMicS

Just want to mention that I stumbled upon the same issue and I personally so far wasn't able to make the connection work with the underlying VPN connection.

TravSalesman avatar Aug 05 '22 13:08 TravSalesman

the mismatch issue fix is in curent progress and in local development. Will be added soon

MCMicS avatar Aug 05 '22 17:08 MCMicS

released with 0.13.18

see #377

MCMicS avatar Aug 02 '23 19:08 MCMicS