2

I am setting up a Jenkins instance in Docker. I am using /usr/local/bin/plugins.sh to install the plugins. I am copying groovy scripts to /usr/share/jenkins/ref/init.groovy.d/ to initialize some configuration.

I can't figure out how to initialize an Xvfb installation location. There are classes is the org.jenkinsci.plugins.xvfb namespace. I am not sure which class to use to setup a default installation that finds the app from the PATH (which should be the default???).

Help?

chrish
  • 2,352
  • 1
  • 17
  • 32
  • I tried to copy a default file into /var/jenkins_home, but jenkins didn't seem to use it. When I bring up the system configuration, it see it and I can apply the change. Could I do this and then have a groovy script in init.groovy.d that does Jenkins.instance.reload()? – chrish Nov 19 '15 at 22:04

1 Answers1

3

Use this script in init.groovy.d directory:

import jenkins.model.Jenkins
import org.jenkinsci.plugins.xvfb.*

def installation = new XvfbInstallation('default', '/usr/local/bin', null)

Jenkins.getInstance()
       .getDescriptorByType(Xvfb.XvfbBuildWrapperDescriptor.class)
       .setInstallations(installation)

The default is the name of the Xvfb installation, and /usr/local/bin is the directory where Xvfb binary resides, change accordingly.

Zoran Regvart
  • 4,630
  • 22
  • 35