How to configure jenkins with xvnc on OSX Lion for

2019-06-11 17:56发布

问题:

When the jenkins job runs I get this output:

...

Starting xvnc

[workspace] $ /Applications/VNCServer.app/OSXvnc-server -rfbauth /Applications/VNCServer.app/pass.word :11 -geometry 800x600

2012-02-08 22:04:05.375 OSXvnc-server[3412:707] Arguments: -rfbauth /Applications/VNCServer.app/pass.word :11 -geometry 800x600 

2012-02-08 22:04:05.394 OSXvnc-server[3412:707] Main Bundle: /Applications/VNCServer.app
[workspace] $ /bin/sh -xe /var/folders/5d/jp_23pvd3bq5331x7myfcrym0000gq/T/hudson487661983531354780.sh

2012-02-08 22:04:05.425 OSXvnc-server[3412:707] Loading Bundle /Applications/VNCServer.app/Contents/Resources/TigerBundle.bundle

Parsing POMs
2012-02-08 22:04:05.441 OSXvnc-server[3412:707] Loading Bundle /Applications/VNCServer.app/Contents/Resources/JaguarBundle.bundle

2012-02-08 22:04:05.447 OSXvnc-server[3412:707] Running in Little Endian

2012-02-08 22:04:05.448 OSXvnc-server[3412:707] Pasteboard Inaccessible - Pasteboard sharing disabled

2012-02-08 22:04:05.449 OSXvnc-server[3412:707] Waiting for clients

2012-02-08 22:04:05.449 OSXvnc-server[3412:2c03] Using Private Event Source

2012-02-08 22:04:05.450 OSXvnc-server[3412:2c03] No Event Source -- Using 10.3 API

2012-02-08 22:04:05.451 OSXvnc-server[3412:2c03] Using Dynamic Event Tap -- HID for console user

2012-02-08 22:04:05.452 OSXvnc-server[3412:2c03] Registering Bonjour Service(_rfb._tcp.) - jjmacbook.local

2012-02-08 22:04:05.452 OSXvnc-server[3412:3503] IPv6: Started Listener Thread on port 5901

2012-02-08 22:04:05.453 OSXvnc-server[3412:2c03] Started Listener Thread on port 5901

[workspace] $ /Library/Java/Home//bin/java -cp /Users/jenkins/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/Users/jenkins/.jenkins/tools/Maven/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main 

/Users/jenkins/.jenkins/tools/Maven /Users/jenkins/.jenkins/war/WEB-INF/lib/remoting-2.9.jar /Users/jenkins/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 50302

<===[JENKINS REMOTING CAPACITY]===>channel started

Executing Maven:  -B -f /Users/jenkins/.jenkins/jobs/chess-svg/workspace/pom.xml clean install

However the automated UI tests still pops up their windows on my screen.

The vncserver used is http://sourceforge.net/projects/osxvnc/

回答1:

I'm hitting the same sort of problem, and I think it may actually be impossible.

The problem is that the versions of Firefox/Chrome that run on OSX are for OSX, not "plain" X11 -- so even if you run the X11 server and use xvfb / xvnc / whatever and pass in DISPLAY=:123, Firefox/Chrome don't care, because they're not X-based, they're Carbon/Cocoa-based.

You can confirm this yourself as follows:

  1. Run X11 server (from spotlight)
  2. in the new xterm, type "xhost +" (just to make sure)
  3. xvfb -br -screen 0 1280x1024x24 :123123 &
  4. Now you have a new framebuffer on display 123123 -- run an xterm on there:
  5. DISPLAY=:123123 xterm &
  6. Nothing appeared on your main screen, because that new xterm, is in the background. Check it's there:
  7. xlsclients -display :123123
  8. You'll see one entry, the xterm you spawned on there.
  9. Now try it with a browser:
  10. DISPLAY=:123123 /Applications/Firefox.app/Contents/MacOS/firefox
  11. ...and Firefox still shows up on your main screen.

    You can check this with other things -- if you do "DISPLAY=:123123 xcalc", xcalc won't appear on the main screen, but it will show up in the list of things from xlsclients, because it's X-based.

    But if you try "DISPLAY=:123123 /Applications/Calculator/Contents/MacOS/Calculator", the OSX calculator shows up on the main screen, because it's not X-based.

    (another possible solution is to use selenium server, but our web app breaks selenium server so that's not an option for us -- in the end, I switched to using a Windows-based Jenkins install, where selenium and chromedriver works fine when run from Jenkins).