[How to]: Jenkins and Sikuli

Created by RaiMan on on 2012-09-10
Last updated by:
RaiMan on on 2012-09-10

Based on Question https://answers.launchpad.net/sikuli/+question/207756
Thanks to j-the-k (https://launchpad.net/~j-the-k)

Step 1.
Install Sikuli on your remote System and make sure it works. You have to be able to run a sikuli script from command line. You run a sikuli script from command line like this:
- Open terminal
- Change to directory containing the sikulifile: type "cd dir\to\file" without the quotes.
- type "C:\path\to\sikuliinstallation\sikuli-ide.bat -r myscript.sikuli" without the quotes.
If everything is installed correctly, the sikuliscript should execute now.

Step 2.
If you have not done it already, create a jenkins node which will trigger the sikuli script.
- Go to your jenkins: http://your-jenkins.com/computer/
- Klick new node and select dumb slave, give the node any name and click ok
- On the next page, configure the rest of the settings needed for the slave. I'm not going into detail here because this has nothing to do with sikuli and depends on your remote system. If you don't understand this part, please read the jenkins guide. The only important thing is to give the node a unique label.

Step 3.
- In the node list, search for your newly created node and click on it to open it
- click the button to start the slave agent. The slave agent is a java program that has to run on your remote system which will run the sikuli scripts. Again, if this does not work, please try to find help in the jenkins community as this is not a sikuli matter and I'm no jenkins expert.
- If the slave agent is started and connected to jenkins successfully, it should say so in the slave detail view http://your-jenkins.com/computer/yournodename/

Step 4.
In Jenkins, create a new job by clicking the "create new job" link in the left menu in the project overview.
- Choose freestyle project as project type
- On the next page, choose a name and select the checkbox where you can specify on which labels the build may run (don't know the english name of this setting because I use the german version). Enter the label you gave the new node previously

Step 5.
Make jenkins run sikuli:
- Click the "add build step" dropdown and select the windows batch script option
- In the new textarea you can specify your batch script. It sould look like this:
cd C:\path\to\sikulifile\
C:\path\to\sikuliinstallation\sikuli-ide.bat -r myscript.sikuli
- Now you can click "apply"

Step 6.
If you now run the created job, the jenkins slave that runs on the remote system should run the batch file and therefore run the sikuli script.

This is only a very basic guide as jenkins is a very complex software. Of course you can add more build steps, check out code before running the script or any other thing you want to do with jenkins.