You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
Setup Windows Slave node
Use case
- Windows Application build pipeline (Visual Studio C++ / C#)
Tools
- for installing jenkins agent as a windows service
C:/jenkins/> ren winsw.exe jenkins_agent.exe # Create jenkins_agent.xml for service configuration setup C:/jenkins/> jenkins_agent install # to install the service C:/jenkins/> jenkins_agent start # to start the service C:/jenkins/> jenkins_agent stop # to stop the serice- Alternative tool
- nssm - Non-Sucking Service Manager
- Package Manager - Chocolatey
> choco install nssm > nssm install <service-name> > nssm remove <service-name>
Windows
- Create a user 'jenkins'
Steps
- Create a jenkins slave node setup on jenkins server
Slave Machine
- Install Git
- Install AdoptOpenJDK 11 (Preferable the same version as Jenkins Master Version)
- Create a folder
C:\jenkins - Download
agent.jarfrom jenkins server - Run as Administrator a command prompt
- Install the agent service using the
Windows Service Wrapperas a Windows Service and log on asjenkinsuser profile
$ jenkins-agent.exe install
$ jenkins-agent.exe start
$ jenkins-agent.exe stop
- Create a ssh key
ssh-keygenand updatersa_id.pubto git server (eg: under jenkins user) to allow agent to clone from git repo
<service>
<id>jenkins8080agent</id>
<name>Jenkins Agent for jenkins:8080</name>
<description>This service runs agent process connected to jenkins:8080</description>
<env name="JENKINS_HOME" value="%BASE%" />
<executable>C:\tools\jdk-11\bin\java.exe</executable>
<arguments>-jar c:\jenkins\agent.jar -jnlpUrl http://jenkins:8080/jenkins-agent.jnlp -secret abcd -wordDir "c:\jenkins"</arguments>
<log mode="roll" />
<onfailure action="restart" />
<serviceaccount>
<domain>windows-pc</domain>
<user>jenkins</user>
<allowservicelogon>true</allowservicelogon>
</serviceaccount>
</service>
Setup Jenkins build to target windows slave node for build
- Create a build
- Set label to target the slave node
- Git clone to the node
- Run the windows build script on the node