`
shappy1978
  • 浏览: 700104 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Set Jenkins Slave as Windows Service

    博客分类:
  • CI
 
阅读更多

 

Skip to end of metadata

 

Go to start of metadata

 

Table Of Contents

Steps

If you are having trouble getting the Java Web Start agent installed as a Windows service (ie, you followed the instructions on installing the slave as a service here but it didn't work), an alternative method of starting the service automatically when Windows starts is to use the Windows Scheduler. 

We take advantage of the Windows Scheduler's ability to run command at system startup

  1. Configure your node to use the "Launch slave agents via Java Web Start" launch method
    • Click Save
  2. Note the command required to launch the slave
    • On the new slave node's Jenkins page, note the slave command line shown. 
      • It will be like: java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>
  3. Obtain the slave.jar file and copy it to your new Windows slave node
    • In the command line noted in the last step, the "slave.jar" is a hyperlink. Click it to download the slave.jar file.
    • Copy the slave.jar file to a permanent location on your slave machine
  4. Ensure that you have a java version available on your slave machine
    • If not, obtain and install a copy of Java
  5. Run the command manually from a CMD window on your slave to confirm that it works
    • Open the CMD window
    • Run the command (the one like java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>)
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"
    • Stop the command (control-c)
  6. Register a new scheduled job to run the same command
    • Open "Task Scheduler" on your windows machine
      • Start -> Run: task Scheduler
    • Create a basic task (Menu: Action -> Create Basic Task)
      • First page of the wizard:
        • Name: Jenkins Slave
        • Description (optional)
        • Click Next
      • Next page of the wizard
        • When do you want the task to start: select "When the computer starts"
        • Click Next
      • Next page of the wizard
        • What action do you want the task to perform: select "Start a program"
        • Click Next
      • Next page of the wizard
        • Program/Script: enter "java.exe" (or the full path to your java.exe)
        • Add arguments: enter the rest of the command, like " -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>"
        • eg: -jar D:\Scripts\jenkins\slave.jar -jnlpUrl http://jenkinshost.example.com:8080/computer/buildNode1/slave-agent.jnlp -secret d6a84df1fc4f45ddc9c6ab34b08f13391983ffffffffffb3488b7d5ac77fbc7
        • Click Next
      • Next page of the wizard
        • Click the check box "Open the Properties dialog for this task when I click Finish
        • Click Finish
    • Update the task's properties
      • On the General tab
        • Select the user to run the task as
        • Select "Run whether use is logged on or not"
      • On the settings tab
        • Uncheck "Stop the task if it runs longer than"
        • Check "Run the task as soon as possible after a scheduled start is missed"
        • Check "If the task failed, restart every: 10 minutes", and "Attempt to restart up to: 3 times"
      • Click OK
  7. Start the scheduled task and again check that Jenkins can connect
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"
分享到:
评论

相关推荐

    Jenkins节点机slave服务器关机后,开机后agent连接失败的解决方法

    Linux环境下,Centos操作系统,Master机器安装了Jenkins,节点机Slave已做了关联,然后Slave机器关机后,开机然后jnlp连接不上了,如图: 解决排查办法: 方法1_普通执行java -jar agent.jar的命令来连接(失败) 1...

    jenkins slave.jar

    将此文件下载到要配置的Jenkins slave机器的Jenkins代理目录下

    jenkins-slave镜像

    jenkins-slave镜像

    jenkins的slave jar包

    可以用于k8s的slave节点构建工具,也可以用作其他用处

    jenkins_slave.jar

    jenkins节点管理window服务器段启动文件,通过java-Web启动代理

    jenkins-jnlp-slave镜像

    jenkins-jnlp-slave镜像

    jenkins.msi windows版本下载

    jenkins直装版,windows版本

    Jenkins最新安装包 windows 64位 2022.05.05

    选择安装类型时,一般推荐选择"Install as a Windows service",这样Jenkins会在后台作为服务运行。 3. **设置管理员密码**:安装过程中,系统会生成一个初始化管理员密码。这个密码很重要,因为它用于首次登录...

    jenkins docker azure container service

    DevOps tools introduce: jenkins: Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。...container service

    jenkins-slave-docker:Jenkins从站将在Docker中运行

    詹金斯奴隶 移至 使用JNLP的奴隶。 有关更多信息,请参见。 对于具有swarm插件的容器,请参见 跑步 运行Docker容器 docker run csanchez/jenkins-slave -url ...JENKINS_SLAVE_SERVICE_HOST和JEN

    windows下安装Jenkins 2.289.3 jenkins.msi

    jdk1.8支持的最后一个版本jenkins,验证可用Jenkins Jenkins 2.289.3 jenkins.msi jdk1.8支持的最后一个版本jenkins,验证可用Jenkins Jenkins 2.289.3 jenkins.msi jdk1.8支持的最后一个版本jenkins,验证可用...

    docker-jenkins-slave-nodejs

    docker run --name my-jenkins-slave pcvolkmer/jenkins-slave-nodejs GitLab CI的其他用法 该映像可在提供OpenJDK 8和节点环境的使用。 这个示例.gitlab-ci.yml -file描述了一个基于.gitlab-ci.yml的简单构建: ...

    windows 版本的 jenkins

    在Windows环境下安装Jenkins相对简单,我们主要通过MSI(Microsoft Installer)执行程序进行安装。 1. **Jenkins MSI 安装程序**: `jenkins.msi` 文件是专门为Windows设计的安装程序,它将引导用户完成Jenkins的...

    jenkins-slave-image

    这是在k8s中运行jenkins-slave的镜像内容,里面有Dockerfile以及所需要的资源、文件; 也可直接下载:docker pull fandaoshuai/jenkins-slave:v1.0

    jenkins,windows安装包

    在Windows环境中安装Jenkins通常涉及以下步骤: 1. **下载安装包**:首先,你需要从Jenkins官方网站或者通过其他可信渠道获取适用于Windows的安装包,如“jenkins.msi”文件。这个文件是一个基于Windows Installer...

    docker-jenkins-slave:用于 Eficode 的 Jenkins Slave 的 Docker 容器

    码头工人詹金斯奴隶 用于 Eficode 的 Jenkins Slave 的 Docker 容器 用法: docker build -t 'eficode/jenkins-slave:snapshot' . docker push -t 'eficode/jenkins-slave:snapshot'

    windows下验证可用Jenkins 2.346.1

    jdk1.8支持的最后一个版本jenkins,验证可用Jenkins 2.346.1 jenkins.msi jdk1.8支持的最后一个版本jenkins,验证可用Jenkins 2.346.1 jenkins.msi jdk1.8支持的最后一个版本jenkins,验证可用Jenkins 2.346.1 ...

Global site tag (gtag.js) - Google Analytics