Modifying the Jenkins configuration from the command line

You may well be wondering about the XML files at the top level of the Jenkins workspace. These are configuration files. The config.xml file is the main one that deals with the default server values, but there are also specific ones for any plugins that have values set through the GUI.

There is also a jobs subdirectory underneath the workspace. Each individual job configuration is contained in a subdirectory with the same name as the job. The job-specific configuration is then stored in config.xml within the subdirectory. It's a similar situation for the users directory: there is one subdirectory per user, with the personal information stored in config.xml.

Under a controlled situation where all the Jenkins servers in your infrastructure have the same plugins and version levels, it is possible for you to test on one test machine and then push the configuration files to all the other machines. You can then restart the Jenkins servers with the command-line interface (CLI).

This recipe familiarizes you with the main XML configuration structure and then provides hints about the plugin API based on the details of the XML.