export display in a shell script executed by Jenkins

592 views
Skip to first unread message

iostrym

unread,
Jan 7, 2016, 8:07:28 AM1/7/16
to Jenkins Users
Hi,

We have a TCL script that has a GUI that is executed by Jenkins using a shell script in the job.

Then we have to use :

export DISPLAY=:<PORT_NUMBER>

I used things like that to try to avoid the use of a port number that is already used by someone else or by another job :

export DISPLAY=:`expr "$BUILD_NUMBER" + "100"`

Is there a clean way in the jenkins shell script to get a port_number that is free ? so that the job will never fail because of a port_number already existant...

thanks a lot.

Mark Waite

unread,
Jan 7, 2016, 8:24:07 AM1/7/16
to Jenkins Users
The xvnc plugin can start a VNC based X server at the start of your job, and stop it at the end of your job.  Most Linux distributions make it very easy to install Xvnc, then the plugin will use that installation of Xvnc to provide you a display server (and the DISPLAY environment variable).  I had very good results with that plugin.

There is also an Xvfb plugin which uses the X virtual frame buffer driver to do the same thing.  I haven't used it, but there are others who have used it with good results.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cf57c04e-f94c-4b2b-9bcf-c1731ef0c9aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

iostrym

unread,
Jan 7, 2016, 9:05:33 AM1/7/16
to Jenkins Users
Thanks a lot. But is the use of Xvfb plug-in more heavy than a simple export DISPLAY function ? in term of ressource utilization...

iostrym

unread,
Jan 7, 2016, 9:11:21 AM1/7/16
to Jenkins Users
ok i just realized that after the 

export DISPLAY=:<PORT_NUMBER>

I have the command :

Xvfb :`expr "$BUILD_NUMBER" + "100"` &

So using the plugin will have the same impact.

But... in the plugin I don't see anything to use a free port number... it is said that the port_number will be the number of the build. So there will be risk for build to abord if the port_number is take by another job...

Dirk Heinrichs

unread,
Jan 7, 2016, 9:11:33 AM1/7/16
to jenkins...@googlegroups.com
Am 07.01.2016 um 15:05 schrieb iostrym:

Thanks a lot. But is the use of Xvfb plug-in more heavy than a simple export DISPLAY function ? in term of ressource utilization...

Without it, setting DISPLAY for a Jenkins job doesn't make much sense.

Bye...

    Dirk
--

Dirk Heinrichs, Senior Systems Engineer, Engineering Solutions
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Tel: +49 2226 1596666 (Ansage) 1149
Email: d...@recommind.com
Skype: dirk.heinrichs.recommind
www.recommind.com

iostrym

unread,
Jan 7, 2016, 12:47:01 PM1/7/16
to Jenkins Users, dirk.he...@recommind.com
yes, sorry it was a mistake.

anyway, I don't succeed to let jenkins to chose the display number when using Xvbf plugin...

Bap

unread,
Jan 7, 2016, 12:52:31 PM1/7/16
to jenkins...@googlegroups.com

Bap

unread,
Jan 7, 2016, 12:57:10 PM1/7/16
to jenkins...@googlegroups.com
Sorry, you asked for a free port number, but that's not really what you want.

As suggested, you should use
https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin

iostrym

unread,
Jan 8, 2016, 4:05:05 AM1/8/16
to Jenkins Users
thanks a lot. I didn't see this option "Let Xvfb choose display name"

:)
Reply all
Reply to author
Forward
0 new messages