Customizing your install

About customizing your installation parameters

The Jenkins for DC/OS package accepts a range of configuration parameters at install.

By default, Jenkins for DC/OS uses a /tmp directory on the local host to store its configuration and build data. At a minimum, you should change this before going into production. We recommend setting up a shared file system. Alternatively, you can pin to an agent.

We also expect that you’ll want to customize the default Docker container to add your own dependencies.

Using the CLI

About using the CLI

You can perform a custom installation from either the web interface or the CLI.

Creating a JSON file

  1. Create a new file.

    Tip: You might want to choose a pattern like <package-name>-config.json.

    nano jenkins-config.json
    
  2. Use the information in the configuration reference below to build your JSON. This example creates a new Jenkins for DC/OS service named jenkins-myteam and uses the NFS share located at /mnt/nfs/jenkins-data.
    {
        "service": {
            "name": "jenkins-myteam"
        },
        "storage": {
            "host-volume": "/mnt/nfs/jenkins_data"
        }
    }
    

    Tip: The value of host-volume is the base path to a share on a NFS server or other distributed filesystem. The actual path on-disk for this example is /mnt/nfs/jenkins_data/jenkins-myteam.

  3. From the CLI, pass the custom options file.
    dcos package install jenkins --options=jenkins-config.json
    

Configuration reference

The exact configuration can change between releases of the DC/OS Jenkins Service, the following links describe options available for each release.
  • Jenkins 3.6.1-2.190.1 Configuration options.
  • Jenkins 3.6.0-2.190.1 Configuration options.
  • Jenkins 3.5.4-2.150.1 Configuration options.
  • Jenkins 3.5.3-2.150.1 Configuration options.
  • Jenkins 3.5.2-2.107.2 Configuration options.
  • Examples

    Create a new instance pinned to a single host

    You can also specify an optional pinned-hostname constraint. This is useful if you don't have NFS available and need to pin Jenkins to a specific node:

    {
        "service": {
            "name": "jenkins-pinned"
        },
        "storage": {
            "host-volume": "/var/jenkins_data",
            "pinned-hostname": "10.0.0.100"
        }
    }
    

    Modify known hosts

    With the known-hosts option you can specify a space-separated list of hostnames from which to retrieve the SSH public keys. This list will be populated on the Jenkins master when the bootstrap script runs (at container launch time). You must manually ensure that the SSH known hosts list is populated in any Jenkins agent containers. This is discussed further in Customizing your Docker container and you can see an example in the dcos-jenkins-dind-agent repo.

    {
        "service": {
            "name": "jenkins-private-git"
        },
        "storage": {
            "host-volume": "/mnt/nfs/jenkins_data"
        },
        "networking": {
            "known-hosts": "github.com git.apache.org git.example.com"
        }
    }
    

    Setting Jenkins Agent Ports

    The agent-port option can be used to set the Jenkins agent port. Since all resources must be accounted for with Mesos, the Jenkins service does not allow modification of this port via the Jenkins UI. You can specify 0 for a randomized port, or any port between 1025-32000 which are offered by Mesos to the Jenkins framework.

    {
        "service": {
            "name": "jenkins"
        },
        "networking": {
            "agent-port": 30000
        }
    }