Can I use Jenkins with Sikuli?

Asked by ironmantis7x on 2012-09-05

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:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2012-09-10
Last reply:
2014-06-25
j (j-the-k) said : #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.

ironmantis7x (ironmantis7x) said : #2

Thank you for the reply.
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!

________________________________
 From: j <email address hidden>
To: <email address hidden>
Sent: Sunday, September 9, 2012 3:51 AM
Subject: Re: [Question #207756]: Can I use Jenkins with Sikuli?

Your question #207756 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207756

    Status: Open => Answered

j proposed the following answer:
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.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/207756/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/207756

You received this question notification because you asked the question.

j (j-the-k) said : #3

@RayMan maybe you could add this to your FAQ
@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.

RaiMan (raimund-hocke) said : #4

@ j-the-k

Great ! Thanks! Made faq 2093 :-)

ZW (mpc8250) said : #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] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
[info] locale: en_US
Process leaked file descriptors. See http://wiki.hudson-ci.org/display/HUDSON/Spawning+processes+from+build for more information

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

Any more workarounds ?

roger (mkhb654) said : #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

RaiMan (raimund-hocke) said : #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.

grepliz (liz-lam-217) said : #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
# BridJ: LoadLibrary error when loading C:\Windows\SysWOW64\kernel32.dll : %1 is not a valid Win32 application.

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

grepliz (liz-lam-217) said : #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.

Dwarika (m-dwarika89) said : #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
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
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
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
[log] RIGHT CLICK on (38,247)

Can you help with this problem?

Provide an answer of your own, or ask ironmantis7x for more information if necessary.

To post a message you must log in.