How to add Jenkins command line options to CloudBees CI (CloudBees Core)?

Article ID:360039596731
2 minute readKnowledge base

Issue

  • Don’t know how to add/update Jenkins command line options to CloudBees Core or Jenkins

Resolution

It depends on the way you ran Jenkins.

The following links document some of the options. However, the way to learn the options that apply to your version of the product is to use the --help command line option, e.g. java -jar jenkins.war --help.

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 command line options to Jenkins, you need to change the Jenkins service configuration file. You might require elevated privileges to be able to modify this file.

Please read the service config file carefully since they expose some of the features controlled by command line options via the simple variables, e.g., HTTP[S]_PORT, HTTPS_KEYSTORE, etc.

In CloudBees Core on traditional platforms - Operations Center, you can find this file under:

  • /etc/default/cloudbees-core-oc: location for most of the Linux distributions.

  • /etc/sysconfig/cloudbees-core-oc: location for RedHat/CentOS distribution.

  • C:\Program Files\CloudBeesCoreOC\jenkins.xml: default location for Windows.

In CloudBees Core on traditional platforms - Client controller, you can find this file under:

  • /etc/default/cloudbees-core-cm: location for most of the Linux distributions.

  • /etc/sysconfig/cloudbees-core-cm: location for RedHat/CentOS distribution.

  • C:\Program Files\CloudBeesCoreCM\jenkins.xml: default location for Windows.

In CloudBees Jenkins Distribution, you can find this file under:

  • /etc/default/cloudbees-jenkins-distribution: location for most of the Linux distributions.

  • /etc/sysconfig/cloudbees-jenkins-distribution: location for RedHat/CentOS distribution.

  • C:\Program Files\CloudBeesJenkinsDistribution\jenkins.xml: default location for Windows.

In Jenkins LTS and in CloudBees Jenkins Platform - Client controller, you can find this file under:

  • /etc/default/jenkins: location for most of the Linux distributions.

  • /etc/sysconfig/jenkins: location for RedHat/CentOS distribution.

  • C:\Program Files\Jenkins\jenkins.xml: default location for Windows.

In CloudBees Jenkins Platform - Operations Center, you can find this file under:

  • /etc/default/jenkins-oc: location for most of the Linux distributions.

  • /etc/sysconfig/jenkins-oc: location for RedHat/CentOS distribution.

  • C:\Program Files\JenkinsOC\jenkins.xml: default location for Windows.

Debian / Ubuntu based Linux distributions

In your service configuration file, look for the argument JENKINS_ARGS. It should look something like this:

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT"

Then, add the arguments:

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --pluginroot=/var/cache/$NAME/plugin --httpPort=$HTTP_PORT"

RedHat Linux based distributions

In your service configuration file, look for the argument JENKINS_ARGS. It should look something like this:

JENKINS_ARGS=""

Then, add the arguments:

JENKINS_ARGS="--pluginroot=/var/cache/jenkins/plugin"

Running Jenkins in Windows as a Service

In your service configuration file add the arguments into the <arguments> tag. It should look like this
<arguments>-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --pluginroot=/var/cache/jenkins/plugin</arguments>

Running Jenkins inside Docker

The JENKINS_OPTS should be passed to the container via --env JENKINS_OPTS="..." like the following:

docker run --name myjenkins -p 8080:8080 -p 50000:50000 --env JENKINS_OPTS="--prefix=/jenkins" jenkins/jenkins:lts

Cloud Platform

For CloudBees CI on modern cloud platforms (Kubernetes or OpenShift), see: How to add Java arguments to Jenkins on CloudBees CI Modern ?.

CJE 1.x Operation Center

CJE 1.x Managed controllers

Go to CJOC Dashboard and click on Configure on the Managed controller you want to add the Jenkins argument.

mmconfiguration

Once here, you can add your Java arguments under Provisioning > Jenkins Command Line arguments.