03 Марта 2016
Как подключить 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
- Note Windows Password for this guide
- Login to Windows
Create Jenkins User
- Goto
Local Users and Groups
- Click
Users
- 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
- Goto user properties, find
Member Of
addAdministrators
group
Login to Windows as jenkins user
Configure Windows Registry
-
Run
regedit
-
Set
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystemLongPathsEnabled
to1
-
Goto
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem
-
Create/Modify
DWORD-32
with nameLocalAccountTokenFilterPolicy
value1
-
Goto
HKEY_LOCAL_MACHINESystemCurrentControlSetControlLsa
-
Create/Modify
DWORD-32
with nameLMCompatibilityLevel
value2
- send NTLM authentication only
-
Find key
76A64158-CB41-11D1-8B02-00600806D9B6
- it’s in
HKEY_CLASSES_ROOTCLSID
- it’s in
-
Right click and select
Permissions
-
Change owner to
Administrators
select apply to children -
Add
Full Control
toAdministrators
make sure to apply for children as well -
Change owner back to
NT ServiceTrustedInstaller
select apply to children -
Run service
Remote Registry
-
Restart Windows
Configure smb
- Run as
PowerShell
as Administrator - Run
Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol
- Run
Set-SmbServerConfiguration -EnableSMB1Protocol $true
Configure Firewall
- Search for
Windows Defender Firewall
- Click
Advanced settings
- Goto
Inbound Rules
- Add
Remote Assistance TCP 135
- Add
File and Printer Sharing (NB-Name-In) UDP 137
- Add
File and Printer Sharing (NB-Datagram-In) UDP 138
- Add
File and Printer Sharing (NB-Session-In) TCP 139
- Add
File and Printer Sharing (SMB-In) TCP 445
- Add
jenkins-master 40000-60000 TCP 40000-60000
- Add
Administrator at Distance COM+ (DCOM) TCP C:WINDOWSSystem32dllhost.exe
- For all created goto
Properties -> Advanced
and setAllow edge traversal
Install Java
- Open
PowerShell
- Install Scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install git-with-openssh
scoop bucket add java
scoop install ojdkbuild8-full
Configure System Path for Java
- Goto
Control PanelSystem and SecuritySystem
- Goto
Advanced System Settings
- Goto
Environment Variables...
- Add Java Path (
C:Usersjenkinsscoopappsojdkbuild8-fullcurrentbin
installed before by scoop) to SystemPATH
Create EC2 AMI
- 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 inConfigure 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
- Hover over the small “Jenkins” text and a small black down arrow will appear, click it
- Now hover over “Manage Jenkins”
- and then select the “Manage Nodes” option
Next, on the “Manage Nodes” page
- Choose the “New Node” option on the left
- On the next page give the new node a name (I’d suggest setting the node name to the name of the machine)
- 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
- Click the “OK” button
You’ll now be taken to a page for the new node where you should
- Set the “Remote root directory” to a folder somewhere on the slave
- Set the “Launch method” to “Launch slave agents via Java Web Start”
- 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”
- Click the “Save” button
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:
- Should be the Jenkins master machine
- 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
- Click the slave.jar link to download the slave.jar file and copy it to the slave, let’s say to D:Jenkinsslave.jar
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
- Create a string value “Description”
- Populate it with “Jenkins Continuous Integration Slave”
- Create a new key “Parameters”
- Under “Parameters” create a new string value “Application”
- Populate it with the full path to java.exe, something like “C:Program Files (x86)Javajre1.8.0_66binjava.exe”
- Under “Parameters” Create a new string value “AppParameters”
- Populate it with “-jar D:jenkinsslave.jar -jnlpUrl http://jenkins-master:8080/computer/new_machine/slave-agent.jnlp – secret 96c9999999999999999999999999999999999999999”
- The slave.jar should point to the correct location
- The Jenkins master machine name should be correct
- The new Jenkins slave machine should be correct
- Make sure you use the secret for this machine that you copied from the master when adding the new node
Open the Services application from Control Panel – Administrative Tools, find the “Jenkins Slave” service, right click on the service and go to “Properties”.
- 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
- 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
- Go to the “General” tab and change the “Startup type” to “Automatic” – make sure the service starts up when you restart the slave
- 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:
- It should appear as the machine’s name
- And the little picture of a computer will no longer have a little red x next to it
That’s it.
Let me know if you have any problems…