windows - JNLP 连接在 Jenkins 中已被弃用 将 Windows 从属连接到 Jenkins 的新推荐方法是什么?

标签 windows jenkins slave

正如标题已经指出的那样,JNLP 连接已被弃用, Jenkins 还提供了一条消息和一个超链接到

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

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

最佳答案

开源替代品

有一个名为 OpenWebStart 的开源替代品。这是基于 IcedTeaWeb .

更多信息:Java Web Start is dead - long live OpenWebStart!

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



[...]

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 从命令行安装 Jenkins 服务时(又名 winsw-*.exe),不再需要 Java Web Start。看来 JNLP 协议(protocol)仍在幕后使用,因此将来可能仍存在一些弃用问题。
  • Official installation guide

  • 步骤 (假设您已经在 J​​enkins master 中设置了节点):
  • http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ 下载最新的服务包装(例如“winsw-2.2.0-net4.exe”)
    将其放在自定义 WorkDir 路径中,并将其重命名为“jenkins-slave.exe”
  • 下载“agent.jar”:http://YourJenkinsServer:8080/jnlpJars/agent.jar将其放在自定义 WorkDir 路径中,并将其重命名为“slave.jar”
  • 在同一目录下创建“jenkins-slave.xml”:

    <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 master 的节点配置页面上找到 secret 字符串和正确的 jnlpUrl(例如 http://YourJenkinsServer:8080/computer/YourNodeName/ )。
    Official documentation
  • 创建“jenkins-slave.exe.conf”文件以防止可执行文件在早期版本的 .NET Framework 上运行。

    <configuration>
      <startup>
        <supportedRuntime version="v4.0"/>
      </startup>
    </configuration>
    
  • 以管理员身份启动“cmd.exe”并导航到“jenkins-slave.exe”目录。
  • 安装服务:jenkins-slave.exe install
  • 开通服务:sc start YourJenkinsSlaveServiceId
  • 关于windows - JNLP 连接在 Jenkins 中已被弃用 将 Windows 从属连接到 Jenkins 的新推荐方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60372214/

    相关文章:

    hadoop - 映射器顺序执行而不是并行执行

    linux - 具有特定端口的 Jenkins 奴隶

    java - 如何检查一个程序是否安装在Windows系统上

    ruby - 创建一个以当前时间为名称的文件夹

    windows - 安装程序,从互联网直接下载所有需要的文件到安装文件夹

    windows - 获取子项 : Illegal character path error

    github - 为所有 github 存储库生成 jenkins 作业

    java - 如何将应用程序用户名和密码从jenkins传递到maven

    jenkins - Jenkinsfile DSL如何指定目标目录

    Hudson slaves,如何访问工作区