Jenkins Configuration Overview

Issue

  • How and where do I configure Jenkins porperties?
  • How and where do I check Master properties vs Agents properties?

Environment

  • Jenkins
  • CloudBees Jenkins Enterprise (CJE)
  • CloudBees Operation Center (CJOC)

Resolution

The aim of this article is gathering different points where Jenkins can be configured. It is worth to mention that certain properties can be configured in just one place, whereas others can be configured in more that one. In the second case, value assignation for those properties might be overridden.

For example: If the Jenkins instance is launched including http.proxyHost within the JVM startup parameters, any call to Internet resources will go through that proxy. However, if a proxy is defined at Manage Jenkins > Manage Plugins > Advance Tab, those modules which make use of this configuration (i.e. Update Center and installation of tools such as the JDK, Ant and Maven from remote site) will take this second proxy, ignoring the one defined within JVM startup parameters.

Setting/updating Jenkins Configuration

A.- On Jenkins GUI

Settings here are serialized in their respective config.xml inside the JENKINS_HOME.

Recommended: Yes.

Where: Under Manage Jenkins there are pile of properties that can be configured, highlighting:

  • Master, General configuration at Configure System under $Jenkins_URL/configure
  • Agent configuration at $Jenkins_URL/computer/$agent-name/configure

B.- On Servlet configuration

Built in servlet container (Stand-Alone)

The easiest way to execute Jenkins is through the built in servlet container. You can execute Jenkins like this:

> java -jar jenkins.war

Jenkins comes with a different built in servlet container depending on its version:

  • Jenkins < 1.535 ships with Winstone.
  • Jenkins >= 1.535 ships with Jetty.

Recommended: Yes.

Where: Depending on the type of property

a. The java command line to start Jenkins can be customized by Command Line Parameters adding after the jenkins.war.

Example: running Jenkins setting port to 9090

> java -jar jenkins.war --httpPort=9090 

On the other hand, these properties can be included as Jenkins arguments on the init scripts. It differs from different OS, for instance:

  • On Windows: Within the tag <arguments> in the jenkins.xml located under the Jenkins installation directory - commonly C:\Program Files\Jenkins\ or C:\Program Files\Jenkins-OC\.
  • On Linux (Ubuntu): On the property JENKINS_ARGS in the /etc/default/jenkins.

b. Also Jenkins has several “hidden” features that can be enabled via system properties, Features controlled by System Properties right after java command. They are defined by passing -Dproperty=value to the java command line to start Jenkins.

Example: setting “http://example.org” as footerURL

> java -Dhudson.footerURL=http://example.org -jar jenkins.war

On the other hand, system properties can be also modified “on the fly” via $JENKINS_URL/script by System.setProperty("property","value"), no “Dproperty”.

Example: Skipping the version check for plugin dependencies

System.setProperty("hudson.PluginWrapper.dependenciesVersionCheck.enabled", "false")

Finally, these properties can be included as Java arguments on the init scripts. Please have a look at How to add Java arguments to Jenkins.

Note: Jenkins ignores command line parameters it doesn’t understand instead of producing an error.

c. The above parameters can be extended via winstone.jar, bundled within jenkins.war. It is Winstone 2.0, the Command Line Interface around Jetty.

Note: winstone.jar can be get by making a copy of jenkins.war and unzipping it.

There are different options of using Winstone 2.0. Anyway, required options: either --webroot OR --warfile OR --webappsDir OR --hostsDir.

Example: running Winstone via warfile, setting prefix to “jenkins-example-a”

> java -jar winstone.jar --warfile=jenkins.war --prefix=jenkins-example-a 

Jenkins within a container

Jenkins can be run into a specific Container, own servlet container configuration would be applied.

Recommended: No. Maintenance is more complicated and less documented.

Where: Depending on the Container and its version, for instance:

C.- On the Deployment descriptor

Recommended: No. Changes at this point will not remain after the next upgrade of the core.

Where: On the web.xml located under <YOUR DEPLOYMENT>/WEB-INF/.

D.- Java HotSpot VM Options

Typical command-line options and environment variables that can affect the performance characteristics of the Java HotSpot Virtual Machine.

Depending on the JDK version:

Recommended: Yes.

Where: Adding them just after java command is an option, but the recommendable way is include them into the jenkins init as explained in How to add Java arguments to Jenkins.

Please review CloudBees Jenkins Platform Supported Java Versions.

Checking Jenkins Configuration

There are several places where it is possible to check used values by the Jenkins properties.

At the GUI

A. Master level

$Jenkins_URL/systemInfo displays a report about:

  • System Properties (name/value pair)
  • Environment Variables (name/value pair)
  • Plugins (name/version/enabled?/Pinned?)

System info

B. Agent level

$Jenkins_URL/computer/$SLAVE_NAME/systemInfo displays a report about:

  • System Properties (name/value pair)
  • Environment Variables (name/value pair)

Agent info

At Support Bundle

Support Core Plugin would need to be installed in the Jenkins instance.

A. Master level
  • about.md saves JVM startup parameters for Master.
  • nodes/master/system.properties.md saves all the configuration for Master.
B. Agent level
  • nodes.md saves JVM startup parameters for Agents/Nodes.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.