# Can I use Jenkins with Sikuli?

I would like to use a Jenkins server to kick off sikuli scripts on a remote windows box that has some scripts that I have written.
Is there a way to do that?

ironmantis7x

## Question information

Language:
English Edit question
Status:
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
 Revision history for this message j (j-the-k) said on 2012-09-09: #1

You only have to install sikuli and run the jenkins slave client on the remote machine and then add a batch script to your build job which contains something like sikuli-ide.bat -r myscript.sikuli.

If you need more details, please tell.

 Revision history for this message ironmantis7x (ironmantis7x) said on 2012-09-10: #2

I will need more details on how to set this up.

Thanks!

ironmantis7x

----------------------------------------------------
Lizard (#4): Leave it to my friend. He can do it!
Scorpion (#3): And who is your friend?
Lizard (#4): A first class kung fu man; an expert!

________________________________
Sent: Sunday, September 9, 2012 3:51 AM
Subject: Re: [Question #207756]: Can I use Jenkins with Sikuli?

Your question #207756 on Sikuli changed:

You only have to install sikuli and run the jenkins slave client on the
remote machine and then add a batch script to your build job which
contains something like sikuli-ide.bat -r myscript.sikuli.

If you need more details, please tell.

--
know that it is solved:

If you still need help, you can reply to this email or go to the
following page to enter your feedback:

 Revision history for this message j (j-the-k) said on 2012-09-10: #3

@ironmantis7x

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.

I hope this guide was clear enough, however if you have still questions, feel free to ask them. I can't help too much with questions about jenkins, though, because I don't use it that often.

 Revision history for this message RaiMan (raimund-hocke) said on 2012-09-10: #4

@ j-the-k

Great ! Thanks! Made faq 2093 :-)

 Revision history for this message ZW (mpc8250) said on 2013-03-05: #5

When we run Hudson we got this error:

C:\software_installations\sikuli-r930-win32\Sikuli-r930-win32\Sikuli-IDE>Sikuli-IDE-w.bat -r C:\Users\rrr\Desktop\sikuli-tests\helloworld2.sikuli
[info] locale: en_US

We tried suggestions in http://wiki.hudson-ci.org/display/HUDSON/Spawning+processes+from+build, still doesnt work.

Any more workarounds ?

 Revision history for this message roger (mkhb654) said on 2014-06-24: #6

How would you run Sikuli using the Java jar for Continue Integration and running it from a third party like Sauce Labs? We have contacted SauceLab and we are getting different response. Any idea?

Thanks

 Revision history for this message RaiMan (raimund-hocke) said on 2014-06-25: #7

@roger
supposing you are developing in Java and use sikuli-java.jar (1.0.1) or sikulixapi.jar(1.1.0+), then with Jenkins the easiest way is to use Maven projects. Then you only need to have a dependency on the Sikuli jar (either path based or after having installed it to your local Maven repo.
This is even for the future, since somewhen during the next months sikulixapi.jar will be available on Maven Central.

I am not familiar with SauceLab, but the approach should be similar.

 Revision history for this message grepliz (liz-lam-217) said on 2014-11-18: #8

When running Sikuli Scripts through a Jenkins Windows slave node, I get the following error:

java.lang.UnsatisfiedLinkError: org.sikuli.basics.SysJNA$WinKernel32.GetEnvironmentVariableW(Lorg/bridj/Pointer;Lorg/bridj/Pointer;I)I at org.sikuli.basics.SysJNA$WinKernel32.GetEnvironmentVariableW(Native Method)

at org.sikuli.basics.SysJNA$WinKernel32.getEnvironmentVariable(SysJNA.java:52) at org.sikuli.basics.ResourceLoader.checkLibsDir(ResourceLoader.java:479) ... java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: org.sikuli.basics.SysJNA$WinKernel32.GetEnvironmentVariableW(Lorg/bridj/Pointer;Lorg/bridj/Pointer;I)I

I'm able to run the scripts just fine if I log directly onto the Windows machine. Has anyone seen this before?

 Revision history for this message grepliz (liz-lam-217) said on 2014-11-19: #9

I just figured it out. I needed to start the slave agent with a 64 bit version of Java (I have both on the machine) and now Sikuli scripts are running on a Jenkins Slave node without problem.

 Revision history for this message Dwarika (m-dwarika89) said on 2015-12-18: #10

hi
sikuli script is stopped in midway while running from jenkin. please find the log below. Any suggestion please

c:\Program Files (x86)\Sikuli X>Sikuli-IDE.bat -r C:\SQL_Testcases\1ihdid.sikuli
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

But when i run the same command manually using command line it works fine as below

c:\Program Files (x86)\Sikuli X>Sikuli-IDE.bat -r C:\SQL_Testcases\1ihdid.sikul
i