run sikuli with jenkins and git

Asked by Monika

Hi! Im new with sikulix and tried to run it with jenkins.

That is my simple sikulix code:

a = 1
b = 5
a= a+b+b+b
print(a)
popat(500,500)
popup("michael jackson")

and i run it via jenkins per git. But whenever i do this error message pops up and jenkins builds infinitely:

Started by user (...)
Building on master in workspace C:\Program Files (x86)\Jenkins\workspace\testing_Stuff
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://github.com/monire-flekt/sikulixTest # timeout=10
Fetching upstream changes from https://github.com/monire-flekt/sikulixTest
 > git.exe --version # timeout=10
 > git.exe fetch --tags --progress https://github.com/monire-flekt/sikulixTest +refs/heads/*:refs/remotes/origin/*
 > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 4597fee8843066f38749211bd9aea5404f7de31b (refs/remotes/origin/master)
Commit message: "hope"
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f 4597fee8843066f38749211bd9aea5404f7de31b
 > git.exe rev-list 8f3bf1c0525ce371715626ae3cdf2fa8390988a4 # timeout=10
[testing_Stuff] $ cmd /c call C:\WINDOWS\TEMP\jenkins8266887865302546890.bat

C:\Program Files (x86)\Jenkins\workspace\testing_Stuff>java -jar sikulix.jar -r stringTest.sikuli
[error] Location: outside any screen (29346096, 0) - subsequent actions might not work as expected
java.awt.Rectangle[x=0,y=0,width=1024,height=768]
16
Build was aborted
(..)
Finished: ABORTED

i am searching very long for an answer about the location error but without any success... any help would be awesome and appreciated very much :)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
masuo (masuo-ohara) said :
#1

It may be able to run through the task scheduler .
Monika's environment is different from my environment , So it may not work. I don't use git.

[my environment:]
PC: Windows7
Sikuli: SikuliX 1.1.0
In my case , the following error has occurred .

[error] Location: outside any screen (14697792, 14697792) - subsequent actions might not work as expected
Then I run a script through the task scheduler , I was sure that it works .

[task scheduler setting:]
Give an appropriate name to the batch file , to register the task .
  For example , I named abc to the task .

[Jenkins setteing:]
Register the schtasks command as the build procedure .
  schtasks /run /tn abc

Revision history for this message
Monika (faysway) said :
#2

I will definitely try that, but I'm not sure how exactly you did that. ( I'm still learning a lot about programming etc.)

Could you give me more detailed reproduction steps of your solution? :)

What script did you use ad where do i put in the schtasks command in Jenkins?

Thank you for your answer!

Revision history for this message
masuo (masuo-ohara) said :
#3

There is a script named "xyz.sikuli" in "C:\Script".

[prepare batch file]
Create a batch file named "xyz.bat" to run the script from command line.

C:\SikuliX\runsikulix.cmd -r C:\Script\xyz.sikuli

[task scheduler setting]
Register "xyz.bat" as the task named "abc".

[Jenkins setteing]
Register the schtasks command as the build procedure.

schtasks /run /tn abc

Revision history for this message
Monika (faysway) said :
#4

I use Windows 10 with sikulix 1.1.1 and can't find the xyz.sikuli file there. You know where it may be ?

Revision history for this message
Monika (faysway) said :
#5

or do you mean xyz sikuli is the file i am working on?

Revision history for this message
Monika (faysway) said :
#6

also jenkins doesnt recognize the schtask /run/tn test (my task is called test) command. where do i have to put that command?
i put it in the configuring of my item. (item -> configure -> build -> execute windows batch command -> schtask/run/tn test)

Did i do anything wrong ? :/

Revision history for this message
Monika (faysway) said :
#7

Thanks masuo, that solved my question.

Revision history for this message
Monika (faysway) said :
#8

I received another strange behaviour, jenkins tries to run the sikuli script via the batch file. I did like masuo said, i made a batch file with this:

ECHO OFF
ECHO %time%
call "C:\Users\Monica Srdic\Desktop\sikulixTest\sikulix.jar" -r "C:\Users\Monica Srdic\Desktop\sikulixTest\stringTest.sikuli\stringTest.py"
ECHO %time%
ECHO done
PAUSE

and I wrote this command in jenkins to execute the task which contains the batch file:
test.bat

But jenkins runs infinitely, did i miss something?

Revision history for this message
masuo (masuo-ohara) said :
#9

Why did you use "call" , "sikulix.jar" , "stringTest.py"?

How to run SikuliX from Command Line
http://sikulix-2014.readthedocs.io/en/latest/faq/010-command-line.html

So batch file should be like this.
"C:\Users\Monica Srdic\Desktop\sikulixTest\runsikulix.cmd" -r "C:\Users\Monica Srdic\Desktop\sikulixTest\stringTest.sikuli"

Why did you use "PAUSE" ?

Revision history for this message
Monika (faysway) said :
#10

I just tested stuff because i didnt have this runsikulix.cmd file,
but i will get it and try like that thanks :)

pause was only for debug purposes

Revision history for this message
Monika (faysway) said :
#11

that happens when i use that batch file like you said:

C:\Program Files (x86)\Jenkins\workspace\testing_Stuff>ECHO OFF
15:12:44,57
+++ JAVA_HOME specified but not useable C:\Program Files\Java\jdk1.8.0_121\
+++ looking for Java in system path and then in standard places
+++ running this Java
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
+++ trying to run SikuliX
+++ using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine -jar C:\Users\Monica Srdic\Desktop\sikulixTest\sikulix.jar -r "C:\Users\Monica Srdic\Desktop\sikulixTest\stringTest.sikuli"
[error] Location: outside any screen (17286592, 0) - subsequent actions might not work as expected

Revision history for this message
RaiMan (raimund-hocke) said :
#12

The environment at the time the SikuliX starts in the Jenkins context, there seems to be no valid screen definition.

Usually Jenkins runs in some "headless" (no real screen) environment in the background.

Look in the net for appropriate solutions to set up some fake-screen in your specific environment (like xvfb or similar)

Revision history for this message
Monika (faysway) said :
#13

okay i will try, thanks!
do i have to set it in sikuli? or do i need an additional environment for that?

Revision history for this message
RaiMan (raimund-hocke) said :
#14

SikuliX is not aware off anything outside.

You have to setup an environment on the Jenkins machine, that behaves as a local real machine as seen from SikuliX.

Revision history for this message
Monika (faysway) said :
#15

ohhh okay... will a VM be enough or does it explicitly have to be setup in jenkins?

Revision history for this message
Monika (faysway) said :
#16

is a xvnc pulugin in jenkins enough? :O

Revision history for this message
RaiMan (raimund-hocke) said :
#17

I do not have enough experience, to help you further.

Check other net resources (e.g. stackoverflow.com) for the gory details.

SikuliX runs in any environment, that has a Java 8 implementation and gives Java the idea, that it runs on a real screen.

Revision history for this message
Monika (faysway) said :
#18

hmmm okay still thanks for your help! :)

Revision history for this message
TestMechanic (ndinev) said :
#19

Here are some tips

1. fix your script by removing pause command - test that it works fine and completes as expected without any user interactions
2. seems you have set up jenkin job - this is ok
3. you need to setup a VM(Or real machine). Make sure there is active UI all the time. You need to turn off any screensavers and etc
4. make sure your jenkins slave is running in the UI session of the VM
5. test your script on the VM

you are ready now to run your jenkins job

Can you help with this problem?

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

To post a message you must log in.