Issue
- Don’t know how to add/update Java arguments to Jenkins in CloudBees Jenkins Enterprise.
Environment
- CloudBees Jenkins Enterprise
- CloudBees Jenkins Enterprise - Managed Master
- CloudBees Jenkins Enterprise - Operations Center
Resolution
In CloudBees Jenkins Enterprise, the Java Options are passed to the JVM running Jenkins via the JAVA_OPTS
Environment Variable set to the container running Jenkins.
- For Operations Center, the configuration is managed via the CJE project:
- the Java Options must be updated and applied
cje prepare cjoc-update
- the Java Options must be updated and applied
- For Managed Masters, the configuration is managed by Operations Center:
- the Java Options must be updated in the Managed Master’s item configuration
- the configuration must be applied by restarting the Managed Master from Operations Center: this will update the
cjoc
Marathon application that will re-provision the Operations Center container with the updated values
Operation Center
See Updating Operations Center parameters in the CLI reference guide
Managed Masters
For Java Heap size (-Xmx
), using a combination of:
* Jenkins Master Memory in MB: This is the amount of RAM that will be given to the container, expressed in megabytes according to the instance capabilities. For instance, in AWS, see instance types.
* JVM Max heap ratio: The ratio of the memory set under “Jenkins Master Memory in MB” to use as heap for the Jenkins master JVM. This must be a decimal between 0 and 1. Values over 0.7 are not recommended and can cause master restarts when running out of memory.
For any others, the Java Options of Managed Masters can be set in different ways:
- Java Options in the Managed Master configuration (per master configuration)
- System Properties in the Managed Master configuration (per master configuration)
When managing many masters, a better strategy is to configure or enforce defaults:
- Default Java Options in the Mesos Master Provisioning global configuration (default options for newly created masters)
- Default System Properties in the Mesos Master Provisioning global configuration (default system properties for newly created masters)
- Global Java Options in the Mesos Master Provisioning global configuration (enforced options for all provisioned masters)
Note: Java Options may contain System Properties, they are prefixed with -D
. System Properties however cannot contain Java Arguments such as -XshowSettings:vm
or -XX:*
.
Master Java Options
Go to Operations Center Dashboard and click on Configure
on the Managed Master you want to add the Java argument.
Once here, you can add your Java arguments under Provisioning > Java Options
(separated with blank spaces, not line breaks).
Master System Properties
Go to Operations Center Dashboard and click on Configure
on the Managed Master you want to add the Java argument.
Once here, you can add your System Properties under Provisioning > System Properties
(separated with line breaks, not blank spaces). For example:
hudson.slaves.NodeProvisioner.initialDelay=0
hudson.DNSMultiCast.disabled=true
Master Default Java Options
Master Default Java Options are the default Java Options added to a Managed Master configuration when it is created. They are configurable in Operations Center.
To configure those Default Java Options, go under Manage Jenkins > Configure System > Mesos Master Provisioning [Advanced] > Default Java Options.
(Note: Changes made to the Default Java Options are not reflected in the configuration of existing Managed Master)
Master Default System Properties
Master Default System Properties are the default System Properties added to a Managed Master configuration when it is created. They are configurable in Operations Center.
To configure those Default System Properties Options, go under Manage Jenkins > Configure System > Mesos Master Provisioning [Advanced] > Default System Properties.
(Note: Changes made to the Default System Properties are not reflected in the configuration of existing Managed Master)
Master Global Java Options
Master Global Java Options are Java options that are enforcibly added to every Managed Master deployment and not configurable from the UI. Those Java Options are automatically appended to the Managed Master’s JAVA_OPTS
environment variable during provisioning. They are enforced to all managed masters and not configurable from the UI.
To configure those Global Java Options, go under Manage Jenkins > Configure System > Mesos Master Provisioning [Advanced] > Global Java Options.
(Note: Changes to the Global Java Options are reflected to every Managed Master when re-provisioned)
2 Comments