Jenkins Properties Overview

Issue

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

Environment

  • Jenkins
  • Managed Master (MM)
  • CloudBees Jenkins Enterprise (CJE) - Legacy
  • CloudBees Operation Center (CJOC) - Legacy

Resolution

Setting

Arguments

The java command line to start Jenkins can be customized by Command Line Parameters adding after the jenkins.war. Jenkins passes all command line parameters to the Winstone servlet container, so you can get more information by looking at the Winstone CLI Configuration

Example: running Jenkins setting port to 9090

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

What is recommended is including these Parameters as Jenkins Arguments on the init files. 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.

Finally, Winstone CLI Configuration can be also done into a config file winstone.properties in the current directory (or in the location specified with --config) at startup. It loads the properties in this file, overrides them with any supplied command line properties, and then starts itself.

Properties

Also Jenkins has several “hidden” features that can be enabled via System Property. This properties are:

Different ways of applying them, depending of the type of product:

1.- CloudBees Jenkins Enterprise (CJE) - Legacy & CloudBees Operation Center (CJOC) - Legacy

  • Option A: right after java command, 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

  • Option B: The recommended way is by including them into the Java arguments on the init scripts. Please have a look at How to add Java arguments to Jenkins.

  • Option C: Create an script under $JENKINS_HOME/init.groovy.d/ including System.setProperty("property","value") (via Groovy does not “Dproperty”)

Example: Creating a file $JENKINS_HOME/init.groovy.d/cjp-CSP.groovy containing

  System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; default-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';")

  • Option D: For debugging purposes can be also modified “on the fly” via $JENKINS_URL/script by System.setProperty("property","value") (via Groovy does not “Dproperty”). Please, note this properties are not persistent, they are gone after the next restart.

Example: Skipping the version check for plugin dependencies

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

2.- Managed Master

  • Option A: The recommended way by updating Managed Master > Configuration > Provisioning > Advanced > System Properties as explained on How to add Java arguments to Jenkins.

  • Option B: For debugging purposes can be also modified “on the fly” via $JENKINS_URL/script by System.setProperty("property","value") (via Groovy does not “Dproperty”). Please, note this properties are not persistent, they are gone after the next restart.

Getting

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

At Script Console

Go $JENKINS_URL/script and use System.getProperty("property")

Example:

System.getProperty("sun.java.command")

Result:

/usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --pluginroot=/var/cache/jenkins/plugins --httpPort=8080 --ajp13Port=-1

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.