Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34809

How to set default xvfb installation?

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not A Defect
    • xvfb-plugin
    • None
    • Jenkins 1.651.2

    Description

      See http://stackoverflow.com/questions/33815008/how-to-configure-xvfb-default-installation-on-jenkins-startup

      I am using groovy scripts copied to /usr/share/jenkins/ref/init.groovy.d/ to do the initial setup of a Docker Jenkins instance. Later I create jobs using the Job DSL Plugin that require Xvfb.

      I can't figure out how to initialize a "default" installation of Xvfb using groovy scripts. I have a work-around where I put a copy of org.jenkinssci.plugins.xvfb.XvfbBuildWrapper.xml and then in the groovy scripts I have one script that runs "Jenkins.instance.doReload()". This broke when I upgraded from 1.0.6 to 1.1.3 since the format of the xml file changed.

      What is the right way to script the creation of a default Xvfb installation?

      Attachments

        Activity

          chris_hubbard Chris Hubbard created issue -
          chris_hubbard Chris Hubbard added a comment -

          Should this be an issue for DSL Plugin or xvfb Plugin?

          chris_hubbard Chris Hubbard added a comment - Should this be an issue for DSL Plugin or xvfb Plugin?
          zregvart zregvart added a comment -

          Hi Chris, I've answered on stackoverflow, pasted here for others to find as well:

          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.

          zregvart zregvart added a comment - Hi Chris, I've answered on stackoverflow, pasted here for others to find as well: 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.
          zregvart zregvart made changes -
          Field Original Value New Value
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Resolved [ 5 ]
          chris_hubbard Chris Hubbard made changes -
          Comment [ Works great. Thanks! ]
          chris_hubbard Chris Hubbard added a comment -

          This worked. Thanks!

          chris_hubbard Chris Hubbard added a comment - This worked. Thanks!
          chris_hubbard Chris Hubbard made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 171000 ] JNJira + In-Review [ 210037 ]

          People

            zregvart zregvart
            chris_hubbard Chris Hubbard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: