Slave node on windows jenkins создание

Настройка Windows клиента на Jenkins, slave node Jenkins on Windows

E-mail

Печать


03 Марта 2016

jenkins_new_0

Как подключить Windows к Jenkins? Как настроить Windows slave node on Jenkins. Есть известная проблема с подключением Windows агента к Jenkins, поэтому используем Java с установкой его в автозагрузку. Работает отлично и стабильно если все сделать по инструкции ниже. Инструкция по английски, но все предельно понятно. Если что не понятно — пишите.

1. Create, activate and update a new Windows VM (если это VM) 

2. Create a local user “jenkins” with password “jenkins”. 

3. Disable password policy (optional): start > type Local security policy > Account Polices > password policy > Meet complexity = disable) 

4. Setup user’s auto login. Run command “netplwiz”, uncheck checkbox, select user “jenkins” and apply changes, enter password “jenkins” two times 

5. Setup time sync server time.domain.com (локальный сервер времени — желательно чтобы Jenkins сервер использовал тот же сервер для синхронизации времени) 

6 .Отключаем котроль подтверждения операций для установки приложений. Go to startup menu, and enter UAC — “Users Account Control Settings”. Turn the slider to down — OFF in the window that pops up. This will disable UAC warnings. (windows 10/2012 — http://winaero.com/blog/how-to-turn-off-and-disable-uac-in-windows-10/) 

Download and install: 

1. Java 

2. Git https://git-scm.com/download, 

3. Install Git, select “3-th” option in a first window 

Create folder C:jenkins 

Create empty bat file C:jenkinsstart_agent.bat 

Add shortcut (ярлык) to Startup folder: 

login as jenkins, create shortcut for C:jenkinsstart_agent.bat on Desktop, 

run shell:startup, paste shortcut in opened folder. 

Setup Git — настройки зависят от вашего Git, здась пример с авторизацией по ключу. 

Run cmd and copy/paste code below: 

git config —global user.name «Jenkins» 

git config —global user.email »
Этот e-mail адрес защищен от спам-ботов, для его просмотра у Вас должен быть включен Javascript
» 

ssh-keygen -t rsa -C »
Этот e-mail адрес защищен от спам-ботов, для его просмотра у Вас должен быть включен Javascript
» (don’t enter password) 

Copy content from file %username%/.ssh/id_rsa.pub and paste as a key in http://local-gerrit.com for user jenkins 

При необходимости — Create a file in folder %username%/.ssh/config 

Hostname local-gerrit.com (ваш git)

Port 29418 (порт на катором отвеяает ваш git)

User jenkins 

Test an ability to clone repository 

git clone ssh://
Этот e-mail адрес защищен от спам-ботов, для его просмотра у Вас должен быть включен Javascript
:29418/project 

On Jenkins server — create a new node on Jenkins as “Dumb Slave”. 

Choose “Launch slave agents via Java Web Start” 

Copy command with particular -secret key 

Open C:jenkinsstart_agent.bat and paste command with particular key: 

Net start w32time 

w32tm /resync 

cd c:jenkins 

start /min java -jar slave.jar -jnlpUrl http://jenkins.domain.com/computer/node-name/slave-agent.jnlp -secret qwerty12

Рестарт Windows.

Все. Если Нода активна, можете запускать на ней работу.

Как мы получали гражданство и паспорта США (для владельцев Green card)< Предыдущая

  Следующая >Alameda windsurfing school. Учимся кататся на доске с парусом в San Francisco Bay Area


Самые новые материалы:

  • — Как научиться управлять парусной яхтой. Мой опыт.
  • — Как мы получали гражданство и паспорта США (для владельцев Green card)

Более старые материалы:

  • — Alameda windsurfing school. Учимся кататся на доске с парусом в San Francisco Bay Area
  • — Контроль свободного места на жестом диске в Windows
  • — NAS-323 Linux Torrent
  • — Самые лучшие художественные фильмы про горы. Список 11-ти лучших фильмов про горы.
  • — Полет над заливом Сан-Франциско или как я не успел испугаться.

Windows Slave with EC2 Fleet Plugin

This guide describes how to configure Windows EC2 Instance to be good for run
as Slave for EC2 Fleet Jenkins Plugin. At the end of this guide you
will get AWS EC2 AMI (Image) which could be used for Auto Scaling Group
or EC2 Spot Fleet to run Windows slaves.

Big thanks to @Michenux for help to find all details

Note Before this, please consider to use Windows OpenSSH
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#launch-windows-slaves-using-microsoft-openssh

Note This guide uses Windows DCOM technology (not open ssh) it doesn’t work over NAT,
so Jenkins Master EC2 Instance should be placed in same VPC as Slaves managed by EC2 Fleet Plugin.

Run EC2 Instance with Windows

  1. Note Windows Password for this guide
  2. Login to Windows

Create Jenkins User

  1. Goto Local Users and Groups
  2. Click Users
  3. Create New with name jenkins
  • Set password and note it
  • Set Password never expires
  • Set User cannot change password
  • Unset User must change password at next logon
  1. Goto user properties, find Member Of add Administrators group

Login to Windows as jenkins user

Configure Windows Registry

  1. Run regedit

  2. Set HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystemLongPathsEnabled to 1

  3. Goto HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem

  4. Create/Modify DWORD-32 with name LocalAccountTokenFilterPolicy value 1

  5. Goto HKEY_LOCAL_MACHINESystemCurrentControlSetControlLsa

  6. Create/Modify DWORD-32 with name LMCompatibilityLevel value 2

    • send NTLM authentication only
  7. Find key 76A64158-CB41-11D1-8B02-00600806D9B6

    • it’s in HKEY_CLASSES_ROOTCLSID
  8. Right click and select Permissions

  9. Change owner to Administrators select apply to children

  10. Add Full Control to Administrators make sure to apply for children as well

  11. Change owner back to NT ServiceTrustedInstaller select apply to children

  12. Run service Remote Registry

  13. Restart Windows

Configure smb

  1. Run as PowerShell as Administrator
  2. Run Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol
  3. Run Set-SmbServerConfiguration -EnableSMB1Protocol $true

Configure Firewall

  1. Search for Windows Defender Firewall
  2. Click Advanced settings
  3. Goto Inbound Rules
  4. Add Remote Assistance TCP 135
  5. Add File and Printer Sharing (NB-Name-In) UDP 137
  6. Add File and Printer Sharing (NB-Datagram-In) UDP 138
  7. Add File and Printer Sharing (NB-Session-In) TCP 139
  8. Add File and Printer Sharing (SMB-In) TCP 445
  9. Add jenkins-master 40000-60000 TCP 40000-60000
  10. Add Administrator at Distance COM+ (DCOM) TCP C:WINDOWSSystem32dllhost.exe
  11. For all created goto Properties -> Advanced and set Allow edge traversal

Install Java

  1. Open PowerShell
  2. Install Scoop Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
    scoop install git-with-openssh
  3. scoop bucket add java
  4. scoop install ojdkbuild8-full

Configure System Path for Java

  1. Goto Control PanelSystem and SecuritySystem
  2. Goto Advanced System Settings
  3. Goto Environment Variables...
  4. Add Java Path (C:Usersjenkinsscoopappsojdkbuild8-fullcurrentbin installed before by scoop) to System PATH

Create EC2 AMI

  1. Goto to AWS Console and create image of preconfigured instance

Before using this AMI for Jenkins Slave

  • Make sure you required traffic could go to Windows from Jenkins. You can find
    required ports above in Configure Firewall section

Troubleshooting

  • https://github.com/jenkinsci/windows-slaves-plugin/blob/35b7f1d77b612af2c45b558b03538d0fb53fc05b/docs/troubleshooting.adoc

Skip to content

I really struggled to find accurate information on how to create a Jenkins slave on windows and have that slave set up as a service.
So here it is…

We’re currently using Windows 7 for the slaves with Jenkins 1.638.

In the Jenkins web client

  1. Hover over the small “Jenkins” text and a small black down arrow will appear, click it
  2. Now hover over “Manage Jenkins”
  3. and then select the “Manage Nodes” option

jenkins nodes

Navigate to the “Manage Nodes” page

Next, on the “Manage Nodes” page

  1. Choose the “New Node” option on the left
  2. On the next page give the new node a name (I’d suggest setting the node name to the name of the machine)
  3. Choose the “Dumb Slave option” – Note that the node name is case sensitive so wherever you refer to it you’ll need to use the exact same name you specify here
  4. Click the “OK” button

Jenkins new node

Add a new node

You’ll now be taken to a page for the new node where you should

  1. Set the “Remote root directory” to a folder somewhere on the slave
  2. Set the “Launch method” to “Launch slave agents via Java Web Start”
  3. Assuming your slave has more than a couple of GB or RAM then it’s also worth adding “-Xmx1024” to the “JVM options” or you may encounter some nasty out of memory errors from java on the slave – if you don’t see the “JVM options” section then click the “Advanced” button on the right hand side under the “Launch method”
  4. Click the “Save” button

jenkins new node setup

Configure the settings for the new node

From the list of nodes click on the one you just created and you will be taken to a page where there will be a command line. You will need to copy the full line and make it available to the slave. In the following diagram:

  1. Should be the Jenkins master machine
  2. is the secret for the Jenkins slave – make sure you make a note of this, you’ll need it on the slave in a minute
  3. Click the slave.jar link to download the slave.jar file and copy it to the slave, let’s say to D:Jenkinsslave.jar

jenkins new node secret

Remember the slave secret

On the Jenkins slave to be

Download and install the Java Runtime Environment.

Download and install the Windows Resource Kit. You will likely be prompted with a message suggesting that the Resource Kit is not compatible with Windows 7, simply assure the installer that you know what you’re doing and install it anyway.

Create a blank service called “Jenkins Slave” by running the following from a command prompt:

"C:Program Files (x86)Windows Resource KitsToolsinstsrv.exe" "Jenkins Slave" "C:Program Files (x86)Windows Resource KitsToolssrvany.exe"

Under the registry key:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesJenkins Slave
  1. Create a string value “Description”
  2. Populate it with “Jenkins Continuous Integration Slave”

jenkins slave registry settings 1

Add the slave service description
  1. Create a new key “Parameters”
  2. Under “Parameters” create a new string value “Application”
  3. Populate it with the full path to java.exe, something like “C:Program Files (x86)Javajre1.8.0_66binjava.exe”
  4. Under “Parameters” Create a new string value “AppParameters”
  5. Populate it with “-jar D:jenkinsslave.jar -jnlpUrl http://jenkins-master:8080/computer/new_machine/slave-agent.jnlp – secret 96c9999999999999999999999999999999999999999”
  6. The slave.jar should point to the correct location
  7. The Jenkins master machine name should be correct
  8. The new Jenkins slave machine should be correct
  9. Make sure you use the secret for this machine that you copied from the master when adding the new node

jenkins slave registry settings 2

Add the rest of the new node registry settings

Open the Services application from Control Panel – Administrative Tools, find the “Jenkins Slave” service, right click on the service and go to “Properties”.

  1. Go to the “Recovery” tab and change “First failure” and “Second failure” to “Restart the Service” – occasionally we found it wouldn’t start up first time out
  2. Go to the “Log On” tab and set an account and password- we found that using an account with local admin rights on the slave machine worked best but this is probably unnecessary
  3. Go to the “General” tab and change the “Startup type” to “Automatic” – make sure the service starts up when you restart the slave
  4. Click the “OK” button

Now start the service

In the Jenkins web client

Give it a few seconds and you should see the new slave come on line in the Jenkins web client:

  1. It should appear as the machine’s name
  2. And the little picture of a computer will no longer have a little red x next to it

jenkins node online

New slave online

That’s it.

Let me know if you have any problems…

Like this post? Please share to your friends:
  • Slack скачать на компьютер windows 11
  • Skystar usb 2 hd ci windows 10
  • Skystar s2 pci драйвер windows 7
  • Skyrim на весь экран windows 10
  • Skyrim квадраты в консоли windows 10