User Tools

Site Tools


devops:ci:jenkins

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:ci:jenkins [2023/11/01 07:15] – removed - external edit (Unknown date) 127.0.0.1devops:ci:jenkins [2024/02/09 07:10] (current) skipidar
Line 1: Line 1:
 +===== Jenkins ======
 +{{https://www.opsmx.com/blog/wp-content/uploads/2020/02/Jenkins-vs-Spinnaker-opsmx.png}}
 +
 +== Pipeline ==
 +{{https://jenkins.io/doc/book/resources/pipeline/realworld-pipeline-flow.png}}
 +
 +== 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.
 +<code>
 +"C:\Program Files (x86)\Sysinternals\Autologon.exe" YOURUSER . YOURPASS
 +</code>
 + 
 + 
 +==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.
 +<code>
 +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
 +</code>
 +
 +
 +== 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.
 +
 +<code>
 +schtasks /Create /RU YOURUSER /RP YOURPASS /SC ONLOGON /TN "Connect to Jenkins as swarm slave" /TR c:\temp\EXP_swarm\addSwarmSlaveToJenkins.bat /IT
 +</code>
 +
 +
 +==== 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
 +
 +<code>
 +@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
 +</code>
 +
 +
 +
 +==== LDAP ====
 +
 +Configuring the Jenkins using LDAP requires a predefined LDAP structure. <br>
 +E.g. putting users to Oraganisational Group "people" <br>
 +Or maintaining groups under Oraganisational Group "groups". <br>
 +Or using Posix Groups for organising people. <br>
 +
 +{{https://i.imgur.com/nN6AOLk.png}}
 +
 +{{https://i.imgur.com/b3ciawu.png}}
 +
 +
 +