Table of Contents
Jenkins
Pipeline
Install build slaves as a service
- download the slave-agent.jnlp from the jenkins node
- open cmd and check the java version. if version is 1.6 get the jdk 7 folder from any RDP and do a cd to the jre\bin path of jdk7
- then type javaws <FQDN of the slave-agent.jnlp>
- once the slave connects, click on file and the n install as service
Using nodes as GUI test nodes in cloud
- To be able to run GUI tests on a test-slave - jenkins-slave process must be executed in Interactive Mode, in a user session.
(services, usual tasks are NOT executed in interactive mode)
- The Windows session should be started automatically directly after the server startup.
- Slave-Machine should register itself automatically as a test-slave at Jenkins, right after the startup.
- The slave must be capable to execute everything, what the tests require.
Start a Windows Session (Interactive mode) at startup
Use the Sysinternals tool Autologon for that.
Execute the following script once for the session to be started automatically.
"C:\Program Files (x86)\Sysinternals\Autologon.exe" YOURUSER . YOURPASS
Tool to connect a machine to the Jenkins as build slave
Use Jenkins-Swarm-Plugin for that,
Execute the following script to connect a machine to a Jenkins as a Slave. The slave will have label “sikuli” . Name this script addSwarmSlaveToJenkins.bat and use it in the next chapter.
java -jar C:\temp\EXP_swarm\swarm-client-2.2-jar-with-dependencies.jar -executors 2 -fsroot c:\Jenkins -labels "sikuli %ComputerName%" -master http://10.0.0.198:5555 -name farm-%ComputerName% -username YOURUSER -password YOURPASS
Start Jenkins - slave within the Interactive-mode-session
Use the Windows Task Scheduler for that.
Execute the following script once to create a task, which will be executed, when the user logs in. Explicitely at Autologon too.
schtasks /Create /RU YOURUSER /RP YOURPASS /SC ONLOGON /TN "Connect to Jenkins as swarm slave" /TR c:\temp\EXP_swarm\addSwarmSlaveToJenkins.bat /IT
Plugins
Here you can download the plugins manually in HPI form, to install them manually https://updates.jenkins-ci.org/download/plugins/
Swarm Plugin
Useful to make nodes add themselves to the Jenkins:
- choosing labels
- choosing environment variables
- …
SCRIPT to spawn a process in Jenkins and monitor log files for text
THe problem is - Jenkins kills spawned processes together with the job. Solution: use a wrapper script. https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build
But indeed no wraper would work reliably, because its a feature of jenkins named “ProcessTreeKiller” which is reponsible for killing the preocesses. This feature can be disabled:
https://wiki.jenkins.io/display/JENKINS/ProcessTreeKiller
@echo off ::start server via a wrapper script, so that Jenkins does not complain about leaking handler https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build set ANTRUN_OUTPUT="C:\tmp\StartWeblogicTOI.html" C:\tmp\wrapperScript.js "C:\tmp\startTOICmd.bat" :: wait until it is up and running set serverisRunning="" :whileWaiting if %serverisRunning% == "" ( echo Waiting for server to start sleep 10 for /f %%i in ('Findstr /I /M /C:"state changed to running" C:\tmp\StartWeblogicTOI.html') do set "serverisRunning='%%i'" goto :whileWaiting ) time /T echo Server is running now