top of page

Understanding the Directories Under Jenkins Home and Their Purposes


Jenkins is a widely used automation server that helps developers build, test, and deploy software efficiently. At the heart of Jenkins lies the JENKINS_HOME directory, which stores all the essential data Jenkins needs to operate. Understanding the structure of this directory and the purpose of its subdirectories can help administrators manage Jenkins more effectively, troubleshoot issues, and customize their setups.


This post explores the key directories found under the Jenkins home directory, explaining what each one contains and why it matters. Whether you are a Jenkins administrator, DevOps engineer, or developer, knowing these details will give you better control over your Jenkins environment.



Eye-level view of Jenkins home directory structure on a server
Jenkins home directory structure overview


What is the Jenkins Home Directory?


The Jenkins home directory, often referred to as JENKINS_HOME, is the main folder where Jenkins stores all its configuration files, job data, plugins, logs, and other runtime information. By default, this directory is located at:


  • Linux/macOS: `/var/lib/jenkins`

  • Windows: `C:\Program Files (x86)\Jenkins`


However, the location can be customized during installation or by setting environment variables.


This directory is critical because Jenkins reads from and writes to it continuously. Losing or corrupting this directory can cause Jenkins to malfunction or lose important data. Therefore, understanding its contents is essential for backup, migration, and maintenance.



Key Directories Under Jenkins Home and Their Purposes


1. `jobs`


This directory contains all the Jenkins jobs (projects) you have created. Each job has its own subdirectory named after the job itself. Inside each job folder, Jenkins stores:


  • Configuration files (`config.xml`) defining the job’s settings.

  • Build records including logs and artifacts from past builds.

  • Workspace data for the job’s source code and build environment.


The `jobs` directory is where Jenkins keeps the history and configuration of every project it manages.


2. `plugins`


The `plugins` directory holds all the Jenkins plugins installed on your server. Plugins extend Jenkins’ functionality by adding new features, integrations, or UI components. Each plugin is stored as a `.hpi` or `.jpi` file here.


When Jenkins starts, it loads plugins from this directory. Managing plugins involves adding, updating, or removing files in this folder, although it’s usually done through the Jenkins UI.


3. `users`


This folder contains data related to Jenkins users. Each user has a subdirectory with their credentials, preferences, and API tokens. This directory helps Jenkins manage authentication and authorization.


4. `secrets`


The `secrets` directory stores sensitive information such as credentials, keys, and tokens in encrypted form. Jenkins uses this folder to keep secrets safe while allowing plugins and jobs to access them securely.


5. `workspace`


This directory holds the working copies of source code for all jobs currently running or recently run. When Jenkins checks out code from version control systems like Git or SVN, it places the files here. This folder is essential for builds that require a clean or persistent workspace.


6. `updates`


Jenkins downloads plugin and core updates into the `updates` directory before applying them. This folder temporarily stores update files and metadata, helping Jenkins manage upgrades smoothly.


7. `logs`


The `logs` directory contains Jenkins system logs. These logs record server activity, errors, warnings, and other runtime information. Reviewing logs is crucial for troubleshooting issues or monitoring Jenkins health.


8. `userContent`


This folder is used to serve static content such as images, HTML files, or scripts that users want to make available through Jenkins. It can be useful for hosting custom resources accessible via the Jenkins web interface.


9. `fingerprints`


Jenkins uses fingerprints to track files across builds and jobs, especially artifacts or dependencies. The `fingerprints` directory stores this metadata, enabling Jenkins to detect when files are reused or changed.


10. `nodes`


If you use Jenkins in a distributed setup with multiple agents (nodes), this directory contains configuration and data for each node. It helps Jenkins manage remote build agents and their connections.



Practical Examples of Using Jenkins Home Directories


  • Backing up Jenkins: To back up your Jenkins server, copy the entire `JENKINS_HOME` directory, including all subdirectories. This ensures you preserve job configurations, build history, plugins, and user data.


  • Migrating Jenkins: When moving Jenkins to a new server, transferring the `JENKINS_HOME` directory keeps your setup intact without reconfiguring jobs or reinstalling plugins.


  • Troubleshooting builds: If a build fails, check the `jobs/<job-name>/builds/<build-number>/log` file inside the `jobs` directory to find detailed logs.


  • Managing plugins manually: If the Jenkins UI is inaccessible, you can add or remove plugin files directly in the `plugins` directory and restart Jenkins.



Tips for Managing Jenkins Home Safely


  • Always stop Jenkins before making manual changes to the `JENKINS_HOME` directory to avoid data corruption.

  • Regularly back up the entire directory, especially before upgrades or major changes.

  • Use Jenkins’ built-in tools or plugins for managing credentials instead of editing files in `secrets` manually.

  • Monitor the size of the `workspace` and `jobs` directories, as they can grow large over time with build artifacts and logs.

  • Clean up old builds and unused plugins to keep the Jenkins home directory manageable.



Understanding the directories under Jenkins home gives you a clearer picture of how Jenkins organizes its data and operates behind the scenes. This knowledge empowers you to maintain your Jenkins server more effectively, troubleshoot problems faster, and ensure your automation environment stays reliable.


Comments


bottom of page