简体   繁体   English

如何从 Maven Run 远程访问 Jenkins

[英]How to Access Jenkins Remotely from Maven Run

Since manually executing steps of my plugin with demo projects takes some time, I'd like to execute it on a separate server using mvn hpi:run .由于使用演示项目手动执行我的插件的步骤需要一些时间,我想使用mvn hpi:run在单独的服务器上执行它。 To access Jenkins on my desktop, I'd like to tunnnel eg using ssh server -L 8080:server .要在我的桌面上访问 Jenkins,我想使用ssh server -L 8080:server进行隧道传输。 Unfortunately, I cannot access the server with tunnelling and even on the server itself, curl localhost:8080 works and curl server:8080 does not work (and ssh server works, so it is not a connection problem).不幸的是,我无法通过隧道访问服务器,甚至在服务器本身上, curl localhost:8080可以工作而curl server:8080不起作用(并且ssh server可以工作,因此它不是连接问题)。

Since ufw is disabled, I assume that the Jenkins which is run by maven usually only listens to 127.0.0.1 .由于 ufw 被禁用,我假设由 maven 运行的 Jenkins 通常只侦听127.0.0.1 To change this, according to https://wiki.jenkins.io/display/JENKINS//Starting+and+Accessing+Jenkins , either setting --httpListenAddress=0.0.0.0 or setting $HTTP_HOST should be possible ( https://serverfault.com/questions/408657/how-to-access-jenkins-remotely-on-ubuntu-12-04-server ).要改变这一点,根据https://wiki.jenkins.io/display/JENKINS//Starting+and+Accessing+Jenkins ,设置--httpListenAddress=0.0.0.0或设置$HTTP_HOST应该是可能的( https:// serverfault.com/questions/408657/how-to-access-jenkins-remotely-on-ubuntu-12-04-server )。

Unfortunately, both versions不幸的是,两个版本

mvn clean hpi:run -DhttpListenAddress=0.0.0.0
export HTTP_HOST=0.0.0.0 && mvn clean hpi:run

did not succeed.没有成功。 Additionally, I guessed -Djetty.host=0.0.0.0 could work ( how to make jetty server accessible from LAN? ) since the port of Jenkins can be set using -Djetty.port , but it also did not work:另外,我猜-Djetty.host=0.0.0.0可以工作( 如何使码头服务器可以从 LAN 访问? )因为 Jenkins 的端口可以使用-Djetty.port设置,但它也不起作用:

mvn clean hpi:run -Djetty.host=0.0.0.0

Is there any option to make a Jenkins plugin directly remote accessible when using hpi:run , or is it necessary to deploy it to a local Jenkins server everytime?使用hpi:run ,是否有任何选项可以使 Jenkins 插件直接远程访问,还是每次都需要将其部署到本地 Jenkins 服务器?

以下为我工作:

mvn -Dhost=0.0.0.0 hpi:run 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM