Jenkins server disk space management policy
Jenkins helps us automate the construction of services while also consuming server disk space. Imagine if there are a large number of projects and the disk space of the Jenkins server is not very large, at intervals, the disk space will be full, resulting in the failure of building Jenkins due to insufficient disk space. At this time, we need some manual intervention to restore the normal operation of Jenkins. Based on the Windows operating system and Jenkins related features, this article solves the above problems.
1. manually delete building records
This is the most basic method to manage disk space by directly physically deleting building records. You can manually delete the building record as follows:
- Go to the Jenkins root directory, which is located in the. jenkins folder in the current user directory by default in Windows.
- Manually delete the building record. The building record is located in. jenkins \ jobs \ XXX \ builds (where XXX is the specific project name) and organized by timestamp. Delete the corresponding building history as needed.
Ii. Transfer Disk Space
The idea of transferring disk space is to change the default home directory of Jenkins to transfer the building record to another disk. Taking Windows as an example, a lot of software is installed on the disk where the user directory is located, resulting in insufficient disk space. Other disk spaces can be dynamically divided and managed. If you can store Jenkins building records in a relatively large space that can be dynamically managed, it will undoubtedly solve the problem of insufficient disk space. The specific operation method is also very simple:
- Create the Jenkins root directory environment variable JENKINS_HOME and map the environment variable to a specific working directory.
- Restart Jenkins.
Of course, transferring disk space is only a relatively optimized strategy. If there is a huge demand for building, this policy is usually a temporary solution, so we still have a third policy.
Iii. Automatically discard historical building data
One build contains two products: Build record and Build artifacts. Building record is a basis for tracking, analysis, and feedback, and has saved value. Outdated building artifacts can usually be discarded directly. Based on the above ideas, Jenkins provides us with the "discard old build" configuration function. You can save the building record and discard the building artifacts through reasonable configuration. The configuration method is as follows:
In the above example, by limiting the maximum number of # builds retained in the release package, we can automatically ensure that only the most recent Build artifacts are saved in the corresponding build results of the project, to optimize the efficiency of disk space usage.
Iv. Summary
With the above three policies, we can choose one or more of them in our actual work to ensure the stability of the Jenkins service.
----------------------------------- Split line -----------------------------------
Automated Testing for building sustainable integration of robotium + jenkins + TMTS in Linux
Modify the jenkins port number in Ubuntu
Build jenkins in Linux
Jenkins Server installation and configuration
Configure role-based project permission management for jenkins
Install jenkins in Ubuntu Desktop 12.04 LTS
Build an Android automatic packaging environment with Jenkins
----------------------------------- Split line -----------------------------------
This article permanently updates the link address: