Jenkins中不推荐使用JNLP Connections,将Windows从站连接到jenkins的新推荐方法是什么? [英] JNLP Connections are deprecated in Jenkins what is the new recommended way connecting a windows slave to jenkins?

查看:192
本文介绍了Jenkins中不推荐使用JNLP Connections,将Windows从站连接到jenkins的新推荐方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于标题已经声明不赞成使用JNLP连接,Jenkins还提供了一条消息和一个超链接到

As the Title already states JNLP Connections are Deprecated Jenkins also gives a Message and a Hyperlink to

https://en.wikipedia.org/wiki/Java_Web_Start#Deprecation

那么现在将Windows Slave附加到Jenkins的推荐方法是什么,在 https://jenkins上似乎没有真正好的指南.io 涵盖了该主题.

So whats now the recommended way attaching a Windows Slave to Jenkins, there seems to be no real good guide on https://jenkins.io covering that topic.

推荐答案

有一个名为 OpenWebStart 的开源替代软件,它基于

There is an open source replacement called OpenWebStart which is based on IcedTeaWeb.

更多信息:

OpenWebStart是WebStart和JNLP的开源实现 标准(JSR-56).

OpenWebStart is an open source implementation of the WebStart and JNLP standards (JSR-56).

[...]

在IcedTeaWeb中,我们目前正在映射JNLP规范, 在最大程度上支持其功能.此外 到以IcedTeaWeb为核心的OpenWebStart,IcedTeaWeb也是 在AdoptOpenJDK中使用,以在Java 8中提供最少的WebStart 发布的AdoptOpenJDK.但是,与 OpenWebStart,因为他们只能使用当前的JVM来运行 基于JNLP的应用程序.

In IcedTeaWeb we are currently working on mapping the JNLP spec and supporting its functions to the greatest extent possible. In addition to OpenWebStart, which uses IcedTeaWeb as its core, IcedTeaWeb is also used within AdoptOpenJDK to provide minimal WebStart in the Java 8 releases of AdoptOpenJDK. However, these are limited compared to OpenWebStart because they can only use the current JVM to run JNLP-based applications.

使用Jenkins服务的命令行安装摆脱Java Web Start

使用jenkins-slave.exe(又名winsw-*.exe)从命令行安装Jenkins服务时,不再需要Java Web Start.似乎JNLP协议仍在幕后使用,因此将来可能仍然存在过时的问题.

Get rid of Java Web Start using command-line installation of Jenkins service

When installing Jenkins service from the command-line using jenkins-slave.exe (aka winsw-*.exe), Java Web Start is no longer required. It seems that JNLP protocol is still used behind the scenes, so it may still have some deprecation issue in the future.

步骤(假设您已经在Jenkins master中设置了节点):

Steps (assuming you have already set up the node in Jenkins master):

  1. http://repo.jenkins下载最新的服务包装-ci.org/releases/com/sun/winsw/winsw/(例如"winsw-2.2.0-net4.exe")
    将其放在自定义WorkDir"路径中,并将其重命名为"jenkins-slave.exe"
  2. 下载"agent.jar":http://YourJenkinsServer:8080/jnlpJars/agent.jar
    将其放在自定义WorkDir"路径中,并将其重命名为"slave.jar"
  3. 在同一目录中创建"jenkins-slave.xml":

  1. Download latest service wrapper from http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ (e. g. "winsw-2.2.0-net4.exe")
    Place it in the Custom WorkDir path and rename it to "jenkins-slave.exe"
  2. Download "agent.jar": http://YourJenkinsServer:8080/jnlpJars/agent.jar
    Place it in the Custom WorkDir path and rename it to "slave.jar"
  3. Create "jenkins-slave.xml" in the same directory:

<service>
  <id>YourJenkinsSlaveServiceId</id>
  <name>Your Jenkins Slave Service Name</name>
  <description>This service runs an agent for Jenkins automation server.</description>
  <executable>C:\Program Files\Java\JRE8\bin\java.exe</executable>
  <arguments>-Xrs -jar "%BASE%\slave.jar" -jnlpUrl http://YourJenkinsServer:8080/computer/YourNodeName/slave-agent.jnlp -secret YourSecretStringConsistingOfHexadecimalCharacters -workDir=C:\YourNodeWorkDir</arguments>
  <logmode>rotate</logmode>
  <onfailure action="restart" />
  <download from="http://YourJenkinsServer:8080/jnlpJars/agent.jar" to="%BASE%\slave.jar"/>
 <extensions>
    <extension enabled="true" className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension" id="killOnStartup">
      <pidfile>%BASE%\jenkins_agent.pid</pidfile>
      <stopTimeout>5000</stopTimeout>
      <stopParentFirst>false</stopParentFirst>
    </extension>
  </extensions>
</service>

  • 根据您的环境调整"jenkins-slave.xml".确保调整所有以"Your"为前缀的字符串以及"java.exe"的路径.您将在Jenkins主服务器的节点配置页面上找到秘密字符串并更正jnlpUrl(例如http://YourJenkinsServer:8080/computer/YourNodeName/).
    官方文档
  • 创建"jenkins-slave.exe.conf"文件,以防止可执行文件在.NET Framework的早期版本上运行.

  • Adjust "jenkins-slave.xml" according to your environment. Make sure to adjust all strings I prefixed with "Your" and also the path to "java.exe". You'll find the secret string and correct jnlpUrl on the node configuration page of Jenkins master (e. g. http://YourJenkinsServer:8080/computer/YourNodeName/).
    Official documentation
  • Create "jenkins-slave.exe.conf" file to prevent the executable from running on an earlier version of the .NET Framework.

    <configuration>
      <startup>
        <supportedRuntime version="v4.0"/>
      </startup>
    </configuration>
    

  • 以管理员身份启动"cmd.exe",并导航到"jenkins-slave.exe"目录.

  • Launch "cmd.exe" as administrator and navigate to directory of "jenkins-slave.exe".

    这篇关于Jenkins中不推荐使用JNLP Connections,将Windows从站连接到jenkins的新推荐方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆