Child pages
  • Xvnc Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View Xvnc on the plugin site for more information.

This plugin lets you run an Xvnc session during a build. This is handy if your build includes UI testing that needs a display available.

Each build using the plugin gets its own display allocated from a free list, by default starting with :10 and ending with :99.
(The $DISPLAY environment variable is set for the build by the plugin.)
Thus you can freely run builds on multiple executors without fear of interference.

If there is some problem starting a display server with a given number, that number will be blacklisted
for the remainder of the Hudson session and the plugin will try ten more times before giving up.
This is commonly due to stale locks that did not get cleaned up properly.
There is also an option to clean up locks when starting the first Xvnc-enabled build in a given session.
You can record your vnc session with VncRecorder Plugin.

Note: you must have started the vncserver at least one time before you use it with hudson. This is to create a password. Otherwise Jenkins fails. This blog post describes how.

If you are running Windows you probably do not want this plugin. This blog post offers an alternative suggestion.

Version History

Version 1.24 (Jul 22 2015)

  • JENKINS-36845: ConcurrentModificationException when using Xvnc plugin on Pipeline.

Version 1.23 (Aug 28 2015)

  • A small bugfix when overwriting the XAUTHORITY env var during vnc setup retry.
  • A workaround for JENKINS-19139 where the xautority file is placed in the slave fs root if the build's workspace contains a space, or in tmp if that also contains a space.

Version 1.22 (Jun 10 2015)

Version 1.20 (Nov 12 2014)

Version 1.19 (skipped)

Version 1.18 (Oct 15 2014)

  • JENKINS-24773 Allocated and blacklisted display number are shared accross all slaves

Version 1.17 (Mar 16 2014)

  • JENKINS-22105 Client is not authorized to connect to Server.
    This will reintroduce the problem with spaces in job names. To avoid that bug:
    • avoid using spaces in job names, or
    • fix the vncserver script: add qoutes around the xauthority filename when xauth is called, or
    • turn off per job xauthority file generation.

Version 1.16 (Mar 5 2014)

Version 1.14 (Apr 10 2013)

Version 1.13 (Apr 9 2013)

  • Automatic clearing of blacklist when run out of available ports

Version 1.12 (Apr 4 2013)

  • Changed the configurable base display number to a configurable range of display numbers.
  • Randomly retry ten times to find a working display number before giving up.
  • JENKINS-16879 More robust display detection needed - builds fail when many builds require Xvnc

Version 1.11 (Jan 14 2012)

  • JENKINS-8670 Bind vncserver to localhost for enhanced security.

Version 1.10 (Jul 19 2010)

  • JENKINS-3285 Option to clean up stale locks & processes.
  • JENKINS-3680 Do not run vncserver -kill in workspace directory.

Version 1.9 (Jun 21 2010)

  • Added a mechanism to exclude Xvnc execution on specific nodes
  • Added an option to skip Xvnc execution on all Windows machines

Version 1.8 (Jan 9 2010)

  • Ensure screenshot is taken when selected
  • Update code for more recent Hudson

Version 1.7 (Apr 15 2009)

  • Retry several times before giving up on attempt to get a display, blacklisting displays each time.

Version 1.6 (Apr 14 2009)

  • If the user forgot to put :$DISPLAY_NUMBER in the command line, issue a warning (report)
  • Better help.
  • Updated to new form validation style.

Version 1.5 (August 11, 2008)

  • Can be configured to take a screenshot of the X session upon build completion. These screenshots are treated as build artifacts. This functionality requires Imagemagick

Version 1.4

  • Updated to work with the latest Hudson patch

6 Comments

  1. More or less a note to self. Possible obstacles:

    • When running Hudson from init-scripts the environment might not be set up for vncserver to succeed. To not interfere with other tools, I resorted to specify the Xvnc Plugin's Command line option like this: sh -c "USER=hudson HOME=/var/lib/hudson vncserver :$DISPLAY_NUMBER -geometry 1024x768 -depth 16"
    • Although anything seems to work now the X11 clients still cannot connect. Edit ~hudson/.vnc/xstartup and insert a new line: xhost +
      Note: This will grant every X11 client access to the display!
    • If twm is the window manager of choice, make sure to have a file ~hudson/.twmrc which contains at least one line: RandomPlacement
  2. Installing XVNC
    

    Preparation

    • Checking internet connectivity
    • Checking update center connectivity
    • java.io.IOException: Server returned HTTP response code: 503 for URL: http://updates.jenkins-ci.org/update-center.json?uctest at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at hudson.model.UpdateCenter$UpdateCenterConfiguration.testConnection(UpdateCenter.java:709) at hudson.model.UpdateCenter$UpdateCenterConfiguration.checkUpdateCenter(UpdateCenter.java:562) at hudson.model.UpdateCenter$ConnectionCheckJob.run(UpdateCenter.java:847) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

    Xvnc Plugin

    Failure - Details
    java.io.IOException: Server returned HTTP response code: 504 for URL:

    http://updates.jenkins-ci.org/download/plugins/xvnc/1.10/xvnc.hpi

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1496)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1490)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1144)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:604)
    at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:935)
    at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1043)
    at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:918)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.io.IOException: Server returned HTTP response code: 504 for URL:

    http://updates.jenkins-ci.org/download/plugins/xvnc/1.10/xvnc.hpi

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2305)
    at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:579)
    at java.net.URLConnection.getContentLength(URLConnection.java:474)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:603)
    ... 9 more

  3. Is there a way to disable the localhost setting for this latest update? I actually want to be able to monitor the vncserver remotely sometimes.

    1. Go into manage Jenkins->Configure System

      under xvnc Command Line user "vncserver :$DISPLAY_NUMBER"

  4. Hi,

    strange!, my UI testing is executing, but the UI didn't display during the testing? any other plugin should install?

    Thanks in advance!

  5. Since a new vnc port was created for each build, why can't I use vnc viewer to access to the created vnc session?

    Thanks!