Resolution
It depends on the way you ran Jenkins.
The Jenkins System and Remoting Properties are added as Java Arguments. |
Testing the properties
IMPORTANT: This type of setting is not persistent; thus, the property default values will be reset after the next restart.
In the Script Console, depending on the property setting.
Most of the Jenkins properties are static, therefore you can update its value like in the following examples:
TcpSlaveAgentListener.CLI_HOST_NAME="<cje.example>" //OR com.cloudbees.hudson.plugins.folder.computed.FolderComputation.BACKUP_LOG_COUNT=10
There are some exceptions like the JENKINS-35484 which makes use of the Jenkins SystemProperties
Traditional Platform
Running Jenkins inside Jetty Winstone container
This is the default way to run Jenkins if you installed Jenkins using system packages.
To pass Java arguments to Jenkins, you need to change the Jenkins service configuration file. You might require elevated privileges to be able to modify this file.
For CloudBees CI on traditional platforms - operations center, you can find this file under:
-
/etc/sysconfig/cloudbees-core-oc
: RPM based Linux distributions -
/etc/default/cloudbees-core-oc
: DEB based Linux distributions -
C:\Program Files\CloudBeesCoreOC\jenkins.xml
: default location for Windows
For CloudBees CI on traditional platforms - client controller, you can find this file under:
-
/etc/sysconfig/cloudbees-core-cm
: RPM based Linux distributions -
/etc/default/cloudbees-core-cm
: DEB based Linux distributions -
C:\Program Files\CloudBeesCoreCM\jenkins.xml
: default location for Windows
For Jenkins®, see Overriding service configurations.
RPM based Linux distributions
In your service configuration file, look for the argument JENKINS_JAVA_OPTIONS
. It should look something like this:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
Starting with version 2.303.2.3 or newer, you should use the following array-based syntax, for example to add -Xms
and -Xmx
arguments:
JENKINS_JAVA_OPTIONS=("-Djava.awt.headless=true") JENKINS_JAVA_OPTIONS+=("-Xms2048m") JENKINS_JAVA_OPTIONS+=("-Xmx2048m")
This array-based syntax is the recommended syntax as it is simpler to comment out individual arguments if required, and comparing differences with backups of the file are simpler.
If running a product version older than 2.303.2.3 use the previous syntax:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xms2048m -Xmx2048m"
Running Jenkins in Windows as a Service
- In your service configuration file (by default $JENKINS_HOME\jenkins.xml) add the arguments into the
<arguments>
tag. It should look like this
<arguments>-Xmx2048m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
Running Jenkins inside Docker
The JAVA_OPTS should be passed to the container via --env JAVA_OPTS="..."
like the following:
docker run --name myjenkins -p 8080:8080 -p 50000:50000 --env JAVA_OPTS=-Dhudson.footerURL=https://mycompany.com jenkins/jenkins:lts
With Docker, in terms of memory, other constraints apply. |
Running Jenkins inside Tomcat
Use environment variable CATALINA_OPTS
:
export CATALINA_OPTS="-DJENKINS_HOME=/path/to/jenkins_home/ -Xmx512m"
It is recommended to configure it in the script $CATALINA_BASE/bin/setenv.sh
(linux) or %CATALINA_BASE%\bin\setenv.bat
(windows) that you’ll create to customize your application server.