Issue
- Don’t know how to add/update Jenkins command line options to CloudBees Core or Jenkins
Environment
- CloudBees CI (CloudBees Core)
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
- CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
- CloudBees Jenkins Distribution
- Jenkins LTS
- CloudBees Jenkins Enterprise
- CloudBees Jenkins Enterprise - Managed Master
- CloudBees Jenkins Enterprise - Operations Center
- CloudBees Jenkins Platform - Client Master
- CloudBees Jenkins Platform - Operations Center
Resolution
It depends on the way you ran Jenkins.
Note: 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
.
Starting and Accessing Jenkins
jenkinsci/winstone: Command-line options
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 Master, 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 Master, 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
CloudBees Core
Operation Center
With Helm
You need to add the Jenkins command line option you would like setting OperationsCenter.JenkinsOpts
(e.g., --set OperationsCenter.JenkinsOpts
).
With .yaml modifications
In the cloudbees-core.yml
locate the cjoc
StatefulSet and add the argument to the existing, i.e.:
...
spec:
containers:
- env:
...
- name: JENKINS_OPTS
value: "--prefix=/cjoc"
Then apply the update configuration - kubectl apply -f cloudbees-core.yml
.
Managed Masters
Go to CJOC Dashboard and click on Configure
on the Managed Master you want to add the Jenkins command line option.
Once here, you can add your Jenkins command line options under Provisioning > Jenkins Command Line arguments
.
In case you would like to make the new Java argument directly applicable for all new Managed Masters created, instead of applying it one by one, you can go under CJOC to Manage Jenkins -> Configure System -> Kubernetes Master Provisioning [Advanced] -> Default Jenkins Command Line arguments
and add the Jenkins command line options there.
CJE 1.x
Operation Center
See Updating Operations Center parameters in the CLI reference guide
Managed Masters
Go to CJOC Dashboard and click on Configure
on the Managed Master you want to add the Jenkins argument.
Once here, you can add your Java arguments under Provisioning > Jenkins Command Line arguments
.
0 Comments